window.QZFL = window.QZFL || {};
if (typeof(QZONE) == "object") {
    QZFL = QZONE;
} else {
    window.QZONE = QZFL = {};
}
QZFL.version = "2.0.9.2";
QZFL._qzfl = 2.092;
QZFL.emptyFn = function() {};
QZFL.returnFn = function(v) {
    return v;
};
QZFL.userAgent = (function() {
    var t, vie, vff, vopera, vsf, vawk, vair, vchrome, winver, wintype, mactype, isBeta, isIPad, isIPhone, discerned, _ua = navigator.userAgent,
    _nv = navigator.appVersion,
    vffRE = /(?:Firefox|GranParadiso|Iceweasel|Minefield).(\d+\.\d+)/i,
    vwebkitRE = /AppleWebKit.(\d+\.\d+)/i,
    vchromeRE = /Chrome.(\d+\.\d+)/i,
    vsafariRE = /Version.(\d+\.\d+)/i,
    vwinRE = /Windows.+?(\d+\.\d+)/,
    vie = vff = vopera = vsf = vawk = vair = vchrome = winver = NaN;
    wintype = mactype = isBeta = isIPad = discerned = false;
    if (window.ActiveXObject) {
        vie = 9 - ((_nv.indexOf("Trident\/5.0") > -1) ? 0 : 1) - (window.XDomainRequest ? 0 : 1) - (window.XMLHttpRequest ? 0 : 1);
        t = navigator.appMinorVersion;
        if (vie > 7 && t && t.toLowerCase().indexOf("beta") > -1) {
            isBeta = true;
        }
    } else if (document.getBoxObjectFor || typeof(window.mozInnerScreenX) != "undefined") {
        t = _ua.match(vffRE);
        vff = parseFloat((t && t[1]) || "3.3", 10);
    } else if (!navigator.taintEnabled) {
        t = _ua.match(vwebkitRE);
        vawk = (t && t.length > 1) ? parseFloat(t[1], 10) : ( !! document.evaluate ? ( !! document.querySelector ? 525 : 420) : 419);
        if ((t = _nv.match(vchromeRE)) || window.chrome) {
            if (!t) {
                t = _ua.match(vchromeRE);
            }
            vchrome = parseFloat((t && t[1]) || "2.0", 10);
        }
        if ((t = _nv.match(vsafariRE)) && !window.chrome) {
            if (!t) {
                t = _ua.match(vsafariRE);
            }
            vsf = parseFloat((t && t[1]) || "3.3", 10);
        }
        if (_ua.indexOf("AdobeAIR") > -1) {
            vair = 1;
        }
        if (_ua.indexOf("iPad") > -1) {
            isIPad = true;
        }
        if (_ua.indexOf("iPhone") > -1) {
            isIPhone = true;
        }
    } else if (window.opera) {
        vopera = parseFloat(_nv, 10);
    } else {
        vie = 6;
    }
    if (_ua.indexOf("Windows") > -1) {
        wintype = true;
        t = _ua.match(vwinRE);
        winver = parseFloat((t && t[1]) || "5.1", 10);
    } else if (_ua.indexOf("Mac OS X") > -1) {
        mactype = true;
    } else {
        wintype = true;
    }
    function adjustBehaviors() {
        if (!adjustBehaviors.adjusted && vie && vie < 7) {
            try {
                document.execCommand('BackgroundImageCache', false, true);
            } catch(ignored) {}
            adjustBehaviors.adjusted = true;
        }
    }
    return {
        beta: isBeta,
        firefox: vff,
        ie: vie,
        opera: vopera,
        air: vair,
        safari: vsf,
        safariV: vsf,
        webkit: vawk,
        chrome: vchrome,
        adjustBehaviors: adjustBehaviors,
        windows: winver || wintype,
        isiPad: isIPad,
        isiPhone: isIPhone,
        macs: mactype
    };
})();
QZFL.object = {
    map: function(object, scope) {
        scope = scope || window;
        QZFL.object.extend(scope, object);
    },
    extend: function() {
        var target = arguments[0] || {},
        i = 1,
        length = arguments.length,
        deep = false,
        options,
        name,
        src,
        copy;
        if (typeof target === "boolean") {
            deep = target;
            target = arguments[1] || {};
            i = 2;
        }
        if (typeof target !== "object" && QZFL.object.getType(target) !== "function") {
            target = {};
        }
        if (length === i) {
            target = QZFL; --i;
        }
        for (; i < length; i++) {
            if ((options = arguments[i]) != null) {
                for (name in options) {
                    src = target[name];
                    copy = options[name];
                    if (target === copy) {
                        continue;
                    }
                    if (deep && copy && typeof copy === "object" && !copy.nodeType) {
                        var clone;
                        if (src) {
                            clone = src;
                        } else if (QZFL.lang.isArray(copy)) {
                            clone = [];
                        } else if (QZFL.object.getType(copy) === 'object') {
                            clone = {};
                        } else {
                            clone = copy;
                        }
                        target[name] = QZFL.object.extend(deep, clone, copy);
                    } else if (copy !== undefined) {
                        target[name] = copy;
                    }
                }
            }
        }
        return target;
    },
    each: function(obj, callback) {
        var name, value, i = 0,
        length = obj.length,
        isObj = (length === undefined) || (typeof(obj) == "function");
        if (isObj) {
            for (name in obj) {
                if (callback.call(obj[name], obj[name], name, obj) === false) {
                    break;
                }
            }
        } else {
            for (value = obj[0]; i < length && callback.call(value, value, i, obj) !== false; value = obj[++i]) {}
        }
        return obj;
    },
    getType: function(obj) {
        return obj === null ? 'null': (obj === undefined ? 'undefined': Object.prototype.toString.call(obj).slice(8, -1).toLowerCase());
    },
    routeRE: /([\d\w_]+)/g,
    route: function(obj, path) {
        obj = obj || {};
        path += '';
        var r = QZFL.object.routeRE,
        m;
        r.lastIndex = 0;
        while ((m = r.exec(path)) !== null) {
            obj = obj[m[0]];
            if (obj === undefined || obj === null) break;
        }
        return obj;
    },
    bind: function(obj, fn) {
        var args = Array.prototype.slice.call(arguments, 2);
        return function() {
            var _obj = obj || this,
            _args = args.concat(Array.prototype.slice.call(arguments, 0));
            if (typeof(fn) == "string") {
                if (_obj[fn]) {
                    return _obj[fn].apply(_obj, _args);
                }
            } else {
                return fn.apply(_obj, _args);
            }
        }
    }
};
QZFL.console = {
    print: function(msg, type) {
        window.console && console.log((type == 4 ? (new Date() + ":") : "") + msg);
    }
};
QZFL.runTime = {
    isDebugMode: false,
    error: QZFL.emptyFn,
    warn: QZFL.emptyFn
};
QZFL.widget = {};
QZFL.namespace = QZFL.object;
QZFL.config = {
    debugLevel: 0,
    defaultDataCharacterSet: "GB2312",
    DCCookieDomain: "qzone.qq.com",
    domainPrefix: "qq.com",
    gbEncoderPath: "http://imgcache.qq.com/qzone/v5/toolpages/",
    FSHelperPage: "http://imgcache.qq.com/qzone/v5/toolpages/fp_gbk.html",
    defaultShareObject: "http://imgcache.qq.com/qzone/v5/toolpages/getset.swf",
    staticServer: "http://imgcache.qq.com/ac/qzone/qzfl/lc/"
};
QZFL.string = {
    RegExps: {
        trim: /^\s+|\s+$/g,
        ltrim: /^\s+/,
        rtrim: /\s+$/,
        nl2br: /\n/g,
        s2nb: /[\x20]{2}/g,
        URIencode: /[\x09\x0A\x0D\x20\x21-\x29\x2B\x2C\x2F\x3A-\x3F\x5B-\x5E\x60\x7B-\x7E]/g,
        escHTML: {
            re_amp: /&/g,
            re_lt: /</g,
            re_gt: />/g,
            re_apos: /\x27/g,
            re_quot: /\x22/g
        },
        escString: {
            bsls: /\\/g,
            nl: /\n/g,
            rt: /\r/g,
            tab: /\t/g
        },
        restXHTML: {
            re_amp: /&amp;/g,
            re_lt: /&lt;/g,
            re_gt: /&gt;/g,
            re_apos: /&(?:apos|#0?39);/g,
            re_quot: /&quot;/g
        },
        write: /\{(\d{1,2})(?:\:([xodQqb]))?\}/g,
        isURL: /^(?:ht|f)tp(?:s)?\:\/\/(?:[\w\-\.]+)\.\w+/i,
        cut: /[\x00-\xFF]/,
        getRealLen: {
            r0: /[^\x00-\xFF]/g,
            r1: /[\x00-\xFF]/g
        },
        format: /\{([\d\w\.]+)\}/g
    },
    commonReplace: function(s, p, r) {
        return s.replace(p, r);
    },
    listReplace: function(s, l) {
        if (QZFL.lang.isHashMap(l)) {
            for (var i in l) {
                s = QZFL.string.commonReplace(s, l[i], i);
            }
            return s;
        } else {
            return s + '';
        }
    },
    trim: function(str) {
        return QZFL.string.commonReplace(str + "", QZFL.string.RegExps.trim, '');
    },
    ltrim: function(str) {
        return QZFL.string.commonReplace(str + "", QZFL.string.RegExps.ltrim, '');
    },
    rtrim: function(str) {
        return QZFL.string.commonReplace(str + "", QZFL.string.RegExps.rtrim, '');
    },
    nl2br: function(str) {
        return QZFL.string.commonReplace(str + "", QZFL.string.RegExps.nl2br, '<br />');
    },
    s2nb: function(str) {
        return QZFL.string.commonReplace(str + "", QZFL.string.RegExps.s2nb, '&nbsp;&nbsp;');
    },
    URIencode: function(str) {
        var cc, ccc;
        return (str + "").replace(QZFL.string.RegExps.URIencode,
        function(a) {
            if (a == "\x20") {
                return "+";
            } else if (a == "\x0D") {
                return "";
            }
            cc = a.charCodeAt(0);
            ccc = cc.toString(16);
            return "%" + ((cc < 16) ? ("0" + ccc) : ccc);
        });
    },
    escHTML: function(str) {
        var t = QZFL.string.RegExps.escHTML;
        return QZFL.string.listReplace((str + ""), {
            '&amp;': t.re_amp,
            '&lt;': t.re_lt,
            '&gt;': t.re_gt,
            '&#039;': t.re_apos,
            '&quot;': t.re_quot
        });
    },
    escString: function(str) {
        var t = QZFL.string.RegExps.escString,
        h = QZFL.string.RegExps.escHTML;
        return QZFL.string.listReplace((str + ""), {
            '\\\\': t.bsls,
            '\\n': t.nl,
            '': t.rt,
            '\\t': t.tab,
            '\\\'': h.re_apos,
            '\\"': h.re_quot
        });
    },
    restHTML: function(str) {
        if (!QZFL.string.restHTML.__utilDiv) {
            QZFL.string.restHTML.__utilDiv = document.createElement("div");
        }
        var t = QZFL.string.restHTML.__utilDiv;
        t.innerHTML = (str + "");
        if (typeof(t.innerText) != 'undefined') {
            return t.innerText;
        } else if (typeof(t.textContent) != 'undefined') {
            return t.textContent;
        } else if (typeof(t.text) != 'undefined') {
            return t.text;
        } else {
            return '';
        }
    },
    restXHTML: function(str) {
        var t = QZFL.string.RegExps.restXHTML;
        return QZFL.string.listReplace((str + ""), {
            '<': t.re_lt,
            '>': t.re_gt,
            '\x27': t.re_apos,
            '\x22': t.re_quot,
            '&': t.re_amp
        });
    },
    write: function(strFormat, someArgs) {
        if (arguments.length < 1 || !QZFL.lang.isString(strFormat)) {
            return '';
        }
        var rArr = QZFL.lang.arg2arr(arguments),
        result = rArr.shift(),
        tmp;
        return result.replace(QZFL.string.RegExps.write,
        function(a, b, c) {
            b = parseInt(b, 10);
            if (b < 0 || (typeof rArr[b] == 'undefined')) {
                return '(n/a)';
            } else {
                if (!c) {
                    return rArr[b];
                } else {
                    switch (c) {
                    case 'x':
                        return '0x' + rArr[b].toString(16);
                    case 'o':
                        return 'o' + rArr[b].toString(8);
                    case 'd':
                        return rArr[b].toString(10);
                    case 'Q':
                        return '\x22' + rArr[b].toString(16) + '\x22';
                    case 'q':
                        return '`' + rArr[b].toString(16) + '\x27';
                    case 'b':
                        return '<' + !!rArr[b] + '>';
                    }
                }
            }
        });
    },
    isURL: function(s) {
        return QZFL.string.RegExps.isURL.test(s);
    },
    customEncode: function(s, type) {
        var r;
        if (typeof type == 'undefined') {
            type = '';
        }
        switch (type.toUpperCase()) {
        case "URICPT":
            r = encodeURIComponent(s);
            break;
        default:
            r = encodeURIComponent(s);
        }
        return r;
    },
    escapeURI: function(s) {
        if (window.encodeURIComponent) {
            return encodeURIComponent(s);
        }
        if (window.escape) {
            return escape(s);
        }
        return '';
    },
    fillLength: function(source, length, ch, isRight) {
        source = source + '';
        if (source.length < length) {
            var res = (1 << (length - source.length)).toString(2).substring(1);
            if (ch) {
                res = res.replace("0", ch);
            }
            return isRight ? (source + res) : (res + source);
        } else {
            return source;
        }
    },
    cut: function(str, bitLen, tails) {
        str += '';
        bitLen -= 0;
        tails = tails || '';
        if (isNaN(bitLen)) {
            return str;
        }
        var len = str.length,
        i = Math.min(Math.floor(bitLen / 2), len),
        cnt = QZFL.string.getRealLen(str.slice(0, i));
        for (; i < len && cnt < bitLen; i++) {
            cnt += 1 + !QZFL.string.RegExps.cut.test(str.charAt(i));
        }
        return str.slice(0, cnt > bitLen ? i - 1 : i) + (i < len ? tails: '');
    },
    getRealLen: function(s, isUTF8) {
        if (typeof(s) != 'string') {
            return 0;
        }
        if (!isUTF8) {
            return s.replace(QZFL.string.RegExps.getRealLen.r0, "**").length;
        } else {
            var cc = s.replace(QZFL.string.RegExps.getRealLen.r1, "");
            return (s.length - cc.length) + (encodeURI(cc).length / 3);
        }
    },
    format: function(str) {
        var args = Array.prototype.slice.call(arguments),
        v;
        str = args.shift() + '';
        if (args.length == 1 && typeof(args[0]) == 'object') {
            args = args[0];
        }
        QZFL.string.RegExps.format.lastIndex = 0;
        return str.replace(QZFL.string.RegExps.format,
        function(m, n) {
            v = QZFL.object.route(args, n);
            return v === undefined ? m: v;
        });
    }
};
QZFL.css = {
    classNameCache: {},
    getClassRegEx: function(className) {
        var o = QZFL.css.classNameCache;
        return o[className] || (o[className] = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)'));
    },
    convertHexColor: function(color) {
        var p = '0x';
        color = (color || '').toString();
        color.charAt(0) == '#' && (color = color.substring(1));
        color.length == 3 && (color = color.replace(/([0-9a-f])/ig, '$1$1'));
        return color.length == 6 ? [p + color.substr(0, 2) - 0, p + color.substr(2, 2) - 0, p + color.substr(4, 2) - 0] : [0, 0, 0];
    },
    styleSheets: {},
    getStyleSheetById: function(id) {
        var s;
        return (s = QZFL.dom.get(id)) && s.sheet || (s = document.styleSheets) && s[id];
    },
    getRulesBySheet: function(sheetId) {
        var ss = typeof(sheetId) == "object" ? sheetId: QZFL.css.getStyleSheetById(sheetId),
        rs = {},
        head,
        base;
        if (ss && !(rs = ss.cssRules || ss.rules)) {
            if (head = document.getElementsByTagName('head')[0]) {
                if (base = head.getElementsByTagName('base')[0]) {
                    QZFL.dom.removeElement(base);
                    rs = ss.cssRules;
                    head.appendChild(base);
                }
            }
        }
        return rs;
    },
    getRuleBySelector: function(sheetId, selector) {
        var _ss = QZFL.css.getStyleSheetById(sheetId),
        _rs = QZFL.css.getRulesBySheet(_ss);
        if (!_rs) {
            return null;
        }
        selector = (selector + '').toLowerCase(); ! _ss.cacheSelector && (_ss.cacheSelector = {});
        var _cs = _ss.cacheSelector[selector];
        if (_cs && _rs[_cs] && selector == (_rs[_cs].selectorText + '').toLowerCase()) {
            return _rs[_cs];
        }
        for (var i = 0,
        len = _rs.length; i < len; i++) {
            if (selector == (_rs[i].selectorText + '').toLowerCase()) {
                _ss.cacheSelector[selector] = i;
                return _rs[i];
            }
        }
        return null;
    },
    insertCSSLink: function(url, id) {
        var doc = document,
        cssLink = (cssLink = $(id)) && cssLink.nodeName == 'LINK' ? cssLink: null,
        head = doc.getElementsByTagName("head")[0];
        if (!cssLink) {
            cssLink = doc.createElement("link");
            id && (cssLink.id = id);
            cssLink.rel = "stylesheet";
            cssLink.rev = "stylesheet";
            cssLink.type = "text/css";
            cssLink.media = "screen";
            head.appendChild(cssLink);
        }
        url && (cssLink.href = url);
        return cssLink.sheet || cssLink;
    },
    insertStyleSheet: function(sheetId, rules) {
        var node = document.createElement("style");
        node.type = 'text/css';
        sheetId && (node.id = sheetId);
        document.getElementsByTagName("head")[0].appendChild(node);
        if (rules) {
            if (node.styleSheet) {
                node.styleSheet.cssText = rules;
            } else {
                node.appendChild(document.createTextNode(rules));
            }
        }
        return node.sheet || node;
    },
    removeStyleSheet: function(id) {
        var _ss = QZFL.css.getStyleSheetById(id);
        _ss && QZFL.dom.removeElement(_ss.owningElement || _ss.ownerNode);
    },
    updateClassName: function(elem, removeNames, addNames) {
        if (!elem || elem.nodeType != 1) {
            return;
        }
        var oriName = elem.className;
        if (removeNames && typeof(removeNames) == 'string' || addNames && typeof(addNames) == 'string') {
            if (removeNames == '*') {
                oriName = '';
            } else {
                var ar = oriName.split(' '),
                i = 0,
                k,
                l = ar.length,
                n,
                b;
                oriName = {};
                for (; i < l; i++) {
                    ar[i] && (oriName[ar[i]] = true);
                }
                if (addNames) {
                    ar = addNames.split(' ');
                    l = ar.length;
                    for (i = 0; i < l; i++) { (n = ar[i]) && !oriName[n] && (b = oriName[n] = true);
                    }
                }
                if (removeNames) {
                    ar = removeNames.split(' ');
                    l = ar.length;
                    for (i = 0; i < l; i++) { (n = ar[i]) && oriName[n] && (b = true) && delete oriName[n];
                    }
                }
                ar.length = 0;
                for (var k in oriName) {
                    ar.push(k);
                }
                oriName = ar.join(' ');
            }
            if (b) {
                elem.className = oriName;
            }
        }
        return oriName;
    },
    hasClassName: function(elem, name) {
        return elem && (elem = elem.className) && name && ((' ' + elem + ' ').indexOf(' ' + name + ' ') + 1);
    },
    addClassName: function(elem, names) {
        QZFL.css.updateClassName(elem, null, names);
    },
    removeClassName: function(elem, names) {
        QZFL.css.updateClassName(elem, names);
    },
    replaceClassName: function(elems, a, b) {
        QZFL.css.swapClassName(elems, a, b, true);
    },
    swapClassName: function(elems, a, b, _isRep) {
        if (elems) {
            if (elems.constructor != Array) {
                elems = [elems];
            }
            for (var elem, i = 0,
            l = elems.length; i < l; i++) {
                if ((elem = elems[i]) && elem.nodeType == 1) {
                    if (QZFL.css.hasClassName(elem, a)) {
                        QZFL.css.updateClassName(elem, a, b);
                    } else if (!_isRep && QZFL.css.hasClassName(elem, b)) {
                        QZFL.css.updateClassName(elem, b, a);
                    }
                }
            }
        }
    },
    toggleClassName: function(elem, name) {
        if (!elem || elem.nodeType != 1) {
            return;
        }
        if (QZFL.css.hasClassName(elem, name)) {
            QZFL.css.updateClassName(elem, name);
        } else {
            QZFL.css.updateClassName(elem, null, name);
        }
    }
};
QZFL.dom = {
    getById: function(id) {
        return document.getElementById(id);
    },
    getByName: function(name, tagName, rt) {
        return QZFL.selector((tagName || "") + '[name="' + name + '"]', rt);
    },
    get: function(e) {
        return (typeof(e) == "string") ? document.getElementById(e) : e;
    },
    getNode: function(e) {
        return (e && (e.nodeType || e.item)) ? e: ((typeof(e) == 'string') ? document.getElementById(e) : null);
    },
    removeElement: function(el) {
        if (typeof(el) == "string") {
            el = document.getElementById(el);
        }
        if (!el) {
            return;
        }
        if (el.removeNode) {
            el.removeNode(true);
        } else {
            if (el.parentNode) {
                el.parentNode.removeChild(el);
            }
        }
        el = null;
        return null;
    },
    searchElementByClassName: function(el, className) {
        el = QZFL.dom.get(el);
        if (!el) {
            return null
        }
        var re = QZFL.css.getClassRegEx(className);
        while (el) {
            if (re.test(el.className)) {
                return el;
            }
            el = el.parentNode;
        }
        return null;
    },
    getElementsByClassName: function(className, tag, root) {
        return QZFL.selector((tag || '') + '.' + className, root);
    },
    isAncestor: function(node1, node2) {
        if (!node1 || !node2) {
            return false;
        }
        if (node1.contains && node2.nodeType && !QZFL.userAgent.webkit) {
            return node1.contains(node2) && node1 != node2;
        }
        if (node1.compareDocumentPosition && node2.nodeType) {
            return !! (node1.compareDocumentPosition(node2) & 16);
        } else if (node2.nodeType) {
            return !! QZFL.dom.getAncestorBy(node2,
            function(el) {
                return el == node1;
            });
        }
        return false;
    },
    getAncestorBy: function(node, method) {
        while (node = node.parentNode) {
            if (node && node.nodeType == 1 && (!method || method(node))) {
                return node;
            }
        }
        return null;
    },
    getFirstChild: function(node) {
        node = QZFL.dom.getNode(node);
        if (!node) {
            return null;
        }
        var child = !!node.firstChild && node.firstChild.nodeType == 1 ? node.firstChild: null;
        return child || QZFL.dom.getNextSibling(node.firstChild);
    },
    getNextSibling: function(node) {
        node = QZFL.dom.getNode(node);
        if (!node) {
            return null;
        }
        while (node) {
            node = node.nextSibling;
            if ( !! node && node.nodeType == 1) {
                return node;
            }
        }
        return null;
    },
    getPreviousSibling: function(node) {
        node = QZFL.dom.getNode(node);
        if (!node) {
            return null;
        }
        while (node) {
            node = node.previousSibling;
            if ( !! node && node.nodeType == 1) {
                return node;
            }
        }
        return null;
    },
    swapNode: function(node1, node2) {
        if (node1.swapNode) {
            node1.swapNode(node2);
        } else {
            var prt = node2.parentNode,
            next = node2.nextSibling;
            if (next == node1) {
                prt.insertBefore(node1, node2);
            } else if (node2 == node1.nextSibling) {
                prt.insertBefore(node2, node1);
            } else {
                node1.parentNode.replaceChild(node2, node1);
                prt.insertBefore(node1, next);
            }
        }
    },
    createElementIn: function(tagName, el, insertFirst, attributes) {
        var tagName = tagName || "div",
        el = QZFL.dom.get(el) || document.body,
        _doc = el.ownerDocument,
        _e = _doc.createElement(tagName);
        if (attributes) {
            for (var k in attributes) {
                if (k == "class") {
                    _e.className = attributes[k];
                } else if (k == "style") {
                    _e.style.cssText = attributes[k];
                } else {
                    _e[k] = attributes[k];
                }
            }
        }
        if (insertFirst) {
            el.insertBefore(_e, el.firstChild);
        } else {
            el.appendChild(_e);
        }
        return _e;
    },
    getStyle: function(el, property) {
        el = QZFL.dom.get(el);
        if (!el || el.nodeType == 9) {
            return null;
        }
        var w3cMode = document.defaultView && document.defaultView.getComputedStyle,
        computed = !w3cMode ? null: document.defaultView.getComputedStyle(el, ''),
        value = "";
        switch (property) {
        case "float":
            property = w3cMode ? "cssFloat": "styleFloat";
            break;
        case "opacity":
            if (!w3cMode) {
                var val = 100;
                try {
                    val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
                } catch(e) {
                    try {
                        val = el.filters('alpha').opacity;
                    } catch(e) {}
                }
                return val / 100;
            } else {
                return parseFloat((computed || el.style)[property]);
            }
            break;
        case "backgroundPositionX":
            if (w3cMode) {
                property = "backgroundPosition";
                return ((computed || el.style)[property]).split(" ")[0];
            }
            break;
        case "backgroundPositionY":
            if (w3cMode) {
                property = "backgroundPosition";
                return ((computed || el.style)[property]).split(" ")[1];
            }
            break;
        }
        if (w3cMode) {
            return (computed || el.style)[property];
        } else {
            return (el.currentStyle[property] || el.style[property]);
        }
    },
    setStyle: function(el, properties, value) {
        if (! (el = QZFL.dom.get(el)) || el.nodeType != 1) {
            return false;
        }
        var tmp, bRtn = true,
        w3cMode = (tmp = document.defaultView) && tmp.getComputedStyle,
        rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
        if (typeof(properties) == 'string') {
            tmp = properties;
            properties = {};
            properties[tmp] = value;
        }
        for (var prop in properties) {
            value = properties[prop];
            if (prop == 'float') {
                prop = w3cMode ? "cssFloat": "styleFloat";
            } else if (prop == 'opacity') {
                if (!w3cMode) {
                    prop = 'filter';
                    value = value >= 1 ? '': ('alpha(opacity=' + Math.round(value * 100) + ')');
                }
            } else if (prop == 'backgroundPositionX' || prop == 'backgroundPositionY') {
                tmp = prop.slice( - 1) == 'X' ? 'Y': 'X';
                if (w3cMode) {
                    var v = QZFL.dom.getStyle(el, "backgroundPosition" + tmp);
                    prop = 'backgroundPosition';
                    typeof(value) == 'number' && (value = value + 'px');
                    value = tmp == 'Y' ? (value + " " + (v || "top")) : ((v || 'left') + " " + value);
                }
            }
            if (typeof el.style[prop] != "undefined") {
                el.style[prop] = value + (typeof value === "number" && !rexclude.test(prop) ? 'px': '');
                bRtn = bRtn && true;
            } else {
                bRtn = bRtn && false;
            }
        }
        return bRtn;
    },
    createNamedElement: function(type, name, doc) {
        var _doc = doc || document,
        element;
        try {
            element = _doc.createElement('<' + type + ' name="' + name + '">');
        } catch(ign) {}
        if (!element) {
            element = _doc.createElement(type);
        }
        if (!element.name) {
            element.name = name;
        }
        return element;
    },
    getPosition: function(el) {
        var xy = QZFL.dom.getXY(el),
        size = QZFL.dom.getSize(el);
        return {
            "top": xy[1],
            "left": xy[0],
            "width": size[0],
            "height": size[1]
        };
    },
    setPosition: function(el, pos) {
        QZFL.dom.setXY(el, pos['left'], pos['top']);
        QZFL.dom.setSize(el, pos['width'], pos['height']);
    },
    getXY: function(el, doc) {
        var _t = 0,
        _l = 0,
        _doc = doc || document;
        if (el) {
            if (_doc.documentElement.getBoundingClientRect && el.getBoundingClientRect) {
                var box = el.getBoundingClientRect(),
                oDoc = el.ownerDocument,
                _fix = QZFL.userAgent.ie ? 2 : 0;
                _t = box.top - _fix + QZFL.dom.getScrollTop(oDoc);
                _l = box.left - _fix + QZFL.dom.getScrollLeft(oDoc);
            } else {
                while (el.offsetParent) {
                    _t += el.offsetTop;
                    _l += el.offsetLeft;
                    el = el.offsetParent;
                }
            }
        }
        return [_l, _t];
    },
    getSize: function(el) {
        var _fix = [0, 0];
        if (el) {
            QZFL.object.each(["Left", "Right", "Top", "Bottom"],
            function(v) {
                _fix[v == "Left" || v == "Right" ? 0 : 1] += (parseInt(QZFL.dom.getStyle(el, "border" + v + "Width"), 10) || 0) + (parseInt(QZFL.dom.getStyle(el, "padding" + v), 10) || 0);
            });
            var _w = el.offsetWidth - _fix[0],
            _h = el.offsetHeight - _fix[1];
            return [_w, _h];
        }
        return [ - 1, -1];
    },
    setXY: function(el, x, y) {
        el = QZFL.dom.get(el);
        var _ml = parseInt(QZFL.dom.getStyle(el, "marginLeft")) || 0,
        _mt = parseInt(QZFL.dom.getStyle(el, "marginTop")) || 0;
        QZFL.dom.setStyle(el, "left", parseInt(x) - _ml + "px");
        QZFL.dom.setStyle(el, "top", parseInt(y) - _mt + "px");
    },
    getScrollLeft: function(doc) {
        var _doc = doc || document;
        return Math.max(_doc.documentElement.scrollLeft, _doc.body.scrollLeft);
    },
    getScrollTop: function(doc) {
        var _doc = doc || document;
        return Math.max(_doc.documentElement.scrollTop, _doc.body.scrollTop);
    },
    getScrollHeight: function(doc) {
        var _doc = doc || document;
        return Math.max(_doc.documentElement.scrollHeight, _doc.body.scrollHeight);
    },
    getScrollWidth: function(doc) {
        var _doc = doc || document;
        return Math.max(_doc.documentElement.scrollWidth, _doc.body.scrollWidth);
    },
    setScrollLeft: function(value, doc) {
        var _doc = doc || document;
        _doc[_doc.compatMode == "CSS1Compat" && !QZFL.userAgent.webkit ? "documentElement": "body"].scrollLeft = value;
    },
    setScrollTop: function(value, doc) {
        var _doc = doc || document;
        _doc[_doc.compatMode == "CSS1Compat" && !QZFL.userAgent.webkit ? "documentElement": "body"].scrollTop = value;
    },
    getClientHeight: function(doc) {
        var _doc = doc || document;
        return _doc.compatMode == "CSS1Compat" ? _doc.documentElement.clientHeight: _doc.body.clientHeight;
    },
    getClientWidth: function(doc) {
        var _doc = doc || document;
        return _doc.compatMode == "CSS1Compat" ? _doc.documentElement.clientWidth: _doc.body.clientWidth;
    },
    _SET_SIZE_RE: /^\d+(?:\.\d*)?(px|%|em|in|cm|mm|pc|pt)?$/,
    setSize: function(el, w, h) {
        el = QZFL.dom.get(el);
        var _r = QZFL.dom._SET_SIZE_RE,
        m;
        QZFL.dom.setStyle(el, "width", (m = _r.exec(w)) ? (m[1] ? w: (parseInt(w, 10) + 'px')) : 'auto');
        QZFL.dom.setStyle(el, "height", (m = _r.exec(h)) ? (m[1] ? h: (parseInt(h, 10) + 'px')) : 'auto');
    },
    getDocumentWindow: function(doc) {
        var _doc = doc || document;
        return _doc.parentWindow || _doc.defaultView;
    },
    getElementsByTagNameNS: function(node, ns, tgn) {
        var res = [];
        if (node) {
            if (node.getElementsByTagNameNS) {
                return node.getElementsByTagName(ns + ":" + tgn);
            } else if (node.getElementsByTagName) {
                var n = document.namespaces;
                if (n.length > 0) {
                    var l = node.getElementsByTagName(tgn);
                    for (var i = 0,
                    len = l.length; i < len; ++i) {
                        if (l[i].scopeName == ns) {
                            res.push(l[i]);
                        }
                    }
                }
            }
        }
        return res;
    },
    collection2Array: function(coll) {
        if (QZFL.lang.isArray(coll)) {
            return coll;
        } else {
            var r = [];
            for (var i = 0,
            len = coll.length; i < len; ++i) {
                r.push(coll[i]);
            }
        }
        return r;
    },
    getElementByTagNameBubble: function(a, tn) {
        if (!isNode(a)) {
            return null;
        }
        tn += "";
        var maxLv = 31;
        while (a && a.tagName && (a.tagName != tn.toUpperCase())) {
            if (a == document.body || (--maxLv) < 0) {
                return null;
            }
            a = a.parentNode;
        }
        return a;
    }
};
QZFL.util = {
    buildUri: function(s) {
        return new QZFL.util.URI(s);
    },
    URI: function(s) {
        if (! (QZFL.object.getType(s) == "string")) {
            return null;
        }
        if (s.indexOf("://") < 1) {
            s = location.protocol + "//" + location.host + (s.indexOf("/") == 0 ? "": location.pathname.substr(0, location.pathname.lastIndexOf("/") + 1)) + s;
        }
        var depart = s.split("://");
        if (QZFL.object.getType(depart) == "array" && depart.length > 1 && (/^[a-zA-Z]+$/).test(depart[0])) {
            this.protocol = depart[0].toLowerCase();
            var h = depart[1].split("/");
            if (QZFL.object.getType(h) == "array") {
                this.host = h[0];
                this.pathname = "/" + h.slice(1).join("/").replace(/(\?|\#).+/i, "");
                this.href = s;
                var se = depart[1].lastIndexOf("?"),
                ha = depart[1].lastIndexOf("#");
                this.search = (se >= 0) ? depart[1].substring(se) : "";
                this.hash = (ha >= 0) ? depart[1].substring(ha) : "";
                if (this.search.length > 0 && this.hash.length > 0) {
                    if (ha < se) {
                        this.search = "";
                    } else {
                        this.search = depart[1].substring(se, ha);
                    }
                }
                return this;
            } else {
                return null;
            }
        } else {
            return null;
        }
    }
};
QZFL.lang = {
    isString: function(o) {
        return QZFL.object.getType(o) == "string";
    },
    isArray: function(o) {
        return QZFL.object.getType(o) == "array";
    },
    isFunction: function(o) {
        return QZFL.object.getType(o) == "function";
    },
    isHashMap: function(o) {
        return QZFL.object.getType(o) == "object";
    },
    isNode: function(o) {
        if (typeof(Node) == 'undefined') {
            Node = null;
        }
        try {
            if (!o || !((Node != undefined && o instanceof Node) || o.nodeName)) {
                return false;
            }
        } catch(ignored) {
            return false;
        }
        return true;
    },
    isElement: function(o) {
        return o && o.nodeType == 1;
    }
};
QZFL.queue = (function() {
    var _o = QZFL.object;
    var _queue = {};
    var _Queue = function(key, queue) {
        if (this instanceof arguments.callee) {
            this._qz_queuekey = key;
            return this;
        }
        if (_o.getType(queue = queue || []) == "array") {
            _queue[key] = queue;
        }
        return new _Queue(key);
    };
    var _extend = {
        push: function(key, fn) {
            fn = this._qz_queuekey ? key: fn;
            _queue[this._qz_queuekey || key].push(fn);
        },
        shift: function(key) {
            var _q = _queue[this._qz_queuekey || key];
            if (_q) {
                return QZFL.queue._exec(_q.shift());
            }
        },
        getLen: function(key) {
            return _queue[this._qz_queuekey || key].length;
        },
        run: function(key) {
            var _q = _queue[this._qz_queuekey || key];
            if (_q) {
                _o.each(_q, QZFL.queue._exec);
            }
        },
        timedChunk: function(key, conf) {
            var _q = _queue[this._qz_queuekey || key],
            _conf;
            if (_q) {
                _conf = QZFL.lang.propertieCopy(conf, QZFL.queue._tcCof, null, true);
                setTimeout(function() {
                    var _start = +new Date();
                    do {
                        QZFL.queue.shift(key);
                    } while ( QZFL . queue . getLen ( key ) > 0 && ( + new Date() - _start < _conf.runTime));
                    if (QZFL.queue.getLen(key) > 0) {
                        setTimeout(arguments.callee, _conf.waitTime);
                        _conf.onWait();
                    } else {
                        _conf.onRunEnd();
                    }
                },
                0);
            }
        },
        _tcCof: {
            'runTime': 50,
            'waitTime': 25,
            'onRunEnd': QZFL.emptyFn,
            'onWait': QZFL.emptyFn
        },
        _exec: function(value, key, source) {
            if (!value || _o.getType(value) != "function") {
                if (_o.getType(key) == "number") {
                    source[key] = null;
                }
                return false;
            }
            try {
                return value();
            } catch(e) {
                QZFL.console.print("QZFL Queue Got An Error: [" + e.name + "]  " + e.message, 1)
            }
        }
    };
    _o.extend(_Queue.prototype, _extend);
    _o.extend(_Queue, _extend);
    return _Queue;
})();
QZFL.event = {
    KEYS: {
        BACKSPACE: 8,
        TAB: 9,
        RETURN: 13,
        ESC: 27,
        SPACE: 32,
        LEFT: 37,
        UP: 38,
        RIGHT: 39,
        DOWN: 40,
        DELETE: 46
    },
    _eventListDictionary: {},
    _fnSeqUID: 0,
    _objSeqUID: 0,
    addEvent: function(obj, eventType, fn, argArray) {
        var cfn, res = false,
        l;
        if (!obj) {
            return res;
        }
        if (!obj.eventsListUID) {
            obj.eventsListUID = "e" + (++QZFL.event._objSeqUID);
        }
        if (! (l = QZFL.event._eventListDictionary[obj.eventsListUID])) {
            l = QZFL.event._eventListDictionary[obj.eventsListUID] = {};
        }
        if (!fn.__elUID) {
            fn.__elUID = "e" + (++QZFL.event._fnSeqUID) + obj.eventsListUID;
        }
        if (!l[eventType]) {
            l[eventType] = {};
        }
        if (typeof(l[eventType][fn.__elUID]) == 'function') {
            return false;
        }
        cfn = function(evt) {
            return fn.apply(obj, !argArray ? [QZFL.event.getEvent(evt)] : ([QZFL.event.getEvent(evt)]).concat(argArray));
        };
        if (obj.addEventListener) {
            obj.addEventListener(eventType, cfn, false);
            res = true;
        } else if (obj.attachEvent) {
            res = obj.attachEvent("on" + eventType, cfn);
        } else {
            res = false;
        }
        if (res) {
            l[eventType][fn.__elUID] = cfn;
        }
        return res;
    },
    removeEvent: function(obj, eventType, fn) {
        var cfn = fn,
        res = false,
        l = QZFL.event._eventListDictionary,
        r;
        if (!obj) {
            return res;
        }
        if (!fn) {
            return QZFL.event.purgeEvent(obj, eventType);
        }
        if (obj.eventsListUID && l[obj.eventsListUID]) {
            l = l[obj.eventsListUID][eventType];
            if (l && l[fn.__elUID]) {
                cfn = l[fn.__elUID];
                r = l;
            }
        }
        if (obj.removeEventListener) {
            obj.removeEventListener(eventType, cfn, false);
            res = true;
        } else if (obj.detachEvent) {
            obj.detachEvent("on" + eventType, cfn);
            res = true;
        } else {
            return false;
        }
        if (res && r && r[fn.__elUID]) {
            delete r[fn.__elUID];
        }
        return res;
    },
    purgeEvent: function(obj, type) {
        var l;
        if (obj.eventsListUID && (l = QZFL.event._eventListDictionary[obj.eventsListUID]) && l[type]) {
            for (var k in l[type]) {
                if (obj.removeEventListener) {
                    obj.removeEventListener(type, l[type][k], false);
                } else if (obj.detachEvent) {
                    obj.detachEvent('on' + type, l[type][k]);
                }
            }
        }
        if (obj['on' + type]) {
            obj['on' + type] = null;
        }
        if (l) {
            l[type] = null;
            delete l[type];
        }
        return true;
    },
    getEvent: function(evt) {
        var evt = window.event || evt,
        c, cnt;
        if (!evt && window.Event) {
            c = arguments.callee;
            cnt = 0;
            while (c) {
                if ((evt = c.arguments[0]) && typeof(evt.srcElement) != "undefined") {
                    break;
                } else if (cnt > 9) {
                    break;
                }
                c = c.caller; ++cnt;
            }
        }
        return evt;
    },
    getButton: function(evt) {
        var e = QZFL.event.getEvent(evt);
        if (!e) {
            return - 1
        }
        if (QZFL.userAgent.ie) {
            return e.button - Math.ceil(e.button / 2);
        } else {
            return e.button;
        }
    },
    getTarget: function(evt) {
        var e = QZFL.event.getEvent(evt);
        if (e) {
            return e.srcElement || e.target;
        } else {
            return null;
        }
    },
    getCurrentTarget: function(evt) {
        var e = QZFL.event.getEvent(evt);
        if (e) {
            return e.currentTarget || document.activeElement;
        } else {
            return null;
        }
    },
    cancelBubble: function(evt) {
        evt = QZFL.event.getEvent(evt);
        if (!evt) {
            return false
        }
        if (evt.stopPropagation) {
            evt.stopPropagation();
        } else {
            if (!evt.cancelBubble) {
                evt.cancelBubble = true;
            }
        }
    },
    preventDefault: function(evt) {
        evt = QZFL.event.getEvent(evt);
        if (!evt) {
            return false
        }
        if (evt.preventDefault) {
            evt.preventDefault();
        } else {
            evt.returnValue = false;
        }
    },
    mouseX: function(evt) {
        evt = QZFL.event.getEvent(evt);
        return evt.pageX || (evt.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft));
    },
    mouseY: function(evt) {
        evt = QZFL.event.getEvent(evt);
        return evt.pageY || (evt.clientY + (document.documentElement.scrollTop || document.body.scrollTop));
    },
    getRelatedTarget: function(ev) {
        ev = QZFL.event.getEvent(ev);
        var t = ev.relatedTarget;
        if (!t) {
            if (ev.type == "mouseout") {
                t = ev.toElement;
            } else if (ev.type == "mouseover") {
                t = ev.fromElement;
            } else {}
        }
        return t;
    },
    onDomReady: function(fn) {
        QZFL.event.onDomReady._fn = function() {
            fn();
            QZFL.event.onDomReady._fn = null;
        };
        if (document.addEventListener) {
            if (QZFL.userAgent.safari < 4) {
                var interval = setInterval(function() {
                    if ((/loaded|complete/).test(document.readyState)) {
                        QZFL.event.onDomReady._fn();
                        clearInterval(interval);
                    }
                },
                50);
            } else {
                document.addEventListener("DOMContentLoaded", QZFL.event.onDomReady._fn, true);
            }
        } else {
            var src = window.location.protocol == 'https:' ? '//:': 'javascript:void(0)';
            document.write('<script onreadystatechange="if(this.readyState==\'complete\'){this.parentNode.removeChild(this);QZFL.event.onDomReady._fn();}" defer="defer" src="' + src + '"><\/script\>');
        }
    }
};
QZFL.event.on = QZFL.event.addEvent;
QZFL.event.bind = QZFL.object.bind;; (function() {
    var _handler = QZFL.ElementHandler = function(selector, context) {
        this.elements = null;
        this._isElementHandler = true;
        this._init(selector, context);
    };
    _handler.prototype = {
        _init: function(selector, context) {
            if (QZFL.lang.isString(selector)) {
                this.elements = QZFL.selector(selector, context);
            } else if (selector instanceof QZFL.ElementHandler) {
                this.elements = selector.elements.slice();
            } else if (QZFL.lang.isArray(selector)) {
                this.elements = selector;
            } else if (selector && ((selector.nodeType && selector.nodeType !== 3 && selector.nodeType !== 8) || selector.setTimeout)) {
                this.elements = [selector];
            } else {
                this.elements = [];
            }
        },
        findElements: function(selector) {
            var _pushstack = [],
            _s;
            this.each(function(el) {
                _s = QZFL.selector(selector, el);
                if (_s.length > 0) {
                    _pushstack = _pushstack.concat(_s);
                }
            });
            return _pushstack;
        },
        find: function(selector) {
            return _el.get(this.findElements(selector));
        },
        filter: function(expr, elems, not) {
            if (not) {
                expr = ":not(" + expr + ")";
            }
            return _el.get(QZFL.selector.matches(expr, elems || this.elements));
        },
        each: function(fn) {
            QZFL.object.each(this.elements, fn);
            return this;
        },
        concat: function(elements) {
            return _el.get(this.elements.concat( !! elements._isElementHandler ? elements.elements: elements));
        },
        get: function(index) {
            return _el.get(this.elements[index]);
        },
        slice: function() {
            return _el.get(Array.prototype.slice.apply(this.elements, arguments));
        }
    };
    var _el = QZFL.element = {
        get: function(selector, context) {
            return new _handler(selector, context);
        },
        extend: function(object) {
            QZFL.object.extend(_handler, object);
        },
        extendFn: function(object) {
            QZFL.object.extend(_handler.prototype, object);
        },
        getVersion: function() {
            return _handler.version;
        }
    }
})();
QZFL.element.extend({
    version: "1.0"
});
QZFL.element.extendFn({
    bind: function(evtType, fn) {
        if (typeof(fn) != 'function') {
            return false;
        }
        return this.each(function(el) {
            QZFL.event.addEvent(el, evtType, fn);
        });
    },
    unBind: function(evtType, fn) {
        return this.each(function(el) {
            QZFL.event[fn ? 'removeEvent': 'purgeEvent'](el, evtType, fn);
        });
    },
    onHover: function(fnOver, fnOut) {
        this.onMouseOver(fnOver);
        return this.onMouseOut(fnOut);
    },
    onMouseEnter: function(fn) {
        return this.bind('mouseover',
        function(evt) {
            var rel = QZFL.event.getRelatedTarget(evt);
            if (QZFL.lang.isFunction(fn) && !QZFL.dom.isAncestor(this, rel)) {
                fn.call(this, evt);
            }
        });
    },
    onMouseLeave: function(fn) {
        return this.bind('mouseout',
        function(evt) {
            var rel = QZFL.event.getRelatedTarget(evt);
            if (QZFL.lang.isFunction(fn) && !QZFL.dom.isAncestor(this, rel)) {
                fn.call(this, evt);
            }
        });
    }
});
QZFL.object.each(['onClick', 'onMouseOver', 'onMouseMove', 'onMouseOut', 'onFocus', 'onBlur', 'onKeyDown', 'onKeyPress', 'onKeyUp'],
function(name, index) {
    QZFL.ElementHandler.prototype[name] = function(fn) {
        return this.bind(name.slice(2).toLowerCase(), fn);
    };
});
QZFL.element.extendFn({
    setHtml: function(value) {
        return this.setAttr("innerHTML", value);
    },
    getHtml: function(index) {
        var _e = this.elements[index || 0];
        return !! _e ? _e.innerHTML: null;
    },
    setVal: function(value) {
        if (QZFL.object.getType(value) == "array") {
            var _v = "\x00" + value.join("\x00") + "\x00";
            this.each(function(el) {
                if (/radio|checkbox/.test(el.type)) {
                    el.checked = el.nodeType && ("\x00" + _v.indexOf(el.value.toString() + "\x00") > -1 || _v.indexOf("\x00" + el.name.toString() + "\x00") > -1);
                } else if (el.tagName == "SELECT") {
                    QZFL.object.each(el.options,
                    function(e) {
                        e.selected = e.nodeType == 1 && ("\x00" + _v.indexOf(e.value.toString() + "\x00") > -1 || _v.indexOf("\x00" + e.text.toString() + "\x00") > -1);
                    });
                } else {
                    el.value = value;
                }
            })
        } else {
            this.setAttr("value", value);
        }
        return this;
    },
    getVal: function(index) {
        var _e = this.elements[index || 0],
        _v;
        if (_e) {
            if (_e.tagName == "SELECT") {
                _v = [];
                if (_e.selectedIndex < 0) {
                    return null;
                }
                if (_e.type == "select-one") {
                    _v.push(_e.value);
                } else {
                    QZFL.object.each(_e.options,
                    function(e) {
                        if (e.nodeType == 1 && e.selected) {
                            _v.push(e.value);
                        }
                    });
                }
            } else {
                _v = _e.value;
            }
        } else {
            return null
        }
        return _v;
    },
    hasClass: function(className) {
        if (this.elements && this.elements.length) {
            return QZFL.css.hasClassName(this.elements[0], className);
        }
        return false;
    },
    addClass: function(className) {
        return this.each(function(el) {
            QZFL.css.addClassName(el, className);
        })
    },
    removeClass: function(className) {
        return this.each(function(el) {
            QZFL.css.removeClassName(el, className);
        })
    },
    toggleClass: function(className) {
        return this.each(function(el) {
            QZFL.css.toggleClassName(el, className);
        })
    },
    getSize: function(index) {
        var _e = this.elements[index || 0];
        return !! _e ? QZFL.dom.getSize(_e) : null;
    },
    getXY: function(index) {
        var _e = this.elements[index || 0];
        return !! _e ? QZFL.dom.getXY(_e) : null;
    },
    setSize: function(width, height) {
        return this.each(function(el) {
            QZFL.dom.setSize(el, width, height);
        })
    },
    setXY: function(X, Y) {
        return this.each(function(el) {
            QZFL.dom.setXY(el, X, Y);
        })
    },
    hide: function() {
        return this.each(function(el) {
            QZFL.dom.setStyle(el, "display", "none");
        })
    },
    show: function(isBlock) {
        return this.each(function(el) {
            QZFL.dom.setStyle(el, "display", isBlock ? 'block': '');
        })
    },
    getStyle: function(key, index) {
        var _e = this.elements[index || 0];
        return !! _e ? QZFL.dom.getStyle(_e, key) : null;
    },
    setStyle: function(key, value) {
        return this.each(function(el) {
            QZFL.dom.setStyle(el, key, value);
        })
    },
    setAttr: function(key, value) {
        key = (key == "class" ? "className": key);
        return this.each(function(el) {
            el[key] = value;
        });
    },
    getAttr: function(key, index) {
        key = (key == "class" ? "className": key);
        var _e = this.elements[index || 0];
        return !! _e ? (_e[key] || _e.getAttribute(key)) : null;
    }
});
QZFL.element.extendFn({
    getPrev: function() {
        var _arr = [];
        this.each(function(el) {
            var _e = QZFL.dom.getPreviousSibling(el);
            _arr.push(_e);
        });
        return QZFL.element.get(_arr);
    },
    getNext: function() {
        var _arr = [];
        this.each(function(el) {
            var _e = QZFL.dom.getNextSibling(el);
            _arr.push(_e);
        });
        return QZFL.element.get(_arr);
    },
    getChildren: function() {
        var _arr = [];
        this.each(function(el) {
            var node = QZFL.dom.getFirstChild(el);
            while (node) {
                if ( !! node && node.nodeType == 1) {
                    _arr.push(node);
                }
                node = node.nextSibling;
            }
        });
        return QZFL.element.get(_arr);
    },
    getParent: function() {
        var _arr = [];
        this.each(function(el) {
            var _e = el.parentNode;
            _arr.push(_e);
        });
        return QZFL.element.get(_arr);
    }
});
QZFL.element.extendFn({
    create: function(tagName, attributes) {
        var _arr = [];
        this.each(function(el) {
            _arr.push(QZFL.dom.createElementIn(tagName, el, false, attributes));
        });
        return QZFL.element.get(_arr);
    },
    appendTo: function(el) {
        var el = (el.elements && el.elements[0]) || QZFL.dom.get(el);
        return this.each(function(element) {
            el.appendChild(element)
        });
    },
    insertAfter: function(el) {
        var el = (el.elements && el.elements[0]) || QZFL.dom.get(el),
        _ns = el.nextSibling,
        _p = el.parentNode;
        return this.each(function(element) {
            _p[!_ns ? "appendChild": "insertBefore"](element, _ns);
        });
    },
    insertBefore: function(el) {
        var el = (el.elements && el.elements[0]) || QZFL.dom.get(el),
        _p = el.parentNode;
        return this.each(function(element) {
            _p.insertBefore(element, el)
        });
    },
    remove: function() {
        return this.each(function(el) {
            QZFL.dom.removeElement(el);
        })
    }
});; (function() {
    var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
    done = 0,
    toString = Object.prototype.toString,
    hasDuplicate = false;
    var Sizzle = function(selector, context, results, seed) {
        results = results || [];
        var origContext = context = context || document;
        if (context.nodeType !== 1 && context.nodeType !== 9) {
            return [];
        }
        if (!selector || typeof selector !== "string") {
            return results;
        }
        var parts = [],
        m,
        set,
        checkSet,
        check,
        mode,
        extra,
        prune = true,
        contextXML = isXML(context);
        chunker.lastIndex = 0;
        while ((m = chunker.exec(selector)) !== null) {
            parts.push(m[1]);
            if (m[2]) {
                extra = RegExp.rightContext;
                break;
            }
        }
        if (parts.length > 1 && origPOS.exec(selector)) {
            if (parts.length === 2 && Expr.relative[parts[0]]) {
                set = posProcess(parts[0] + parts[1], context);
            } else {
                set = Expr.relative[parts[0]] ? [context] : Sizzle(parts.shift(), context);
                while (parts.length) {
                    selector = parts.shift();
                    if (Expr.relative[selector]) selector += parts.shift();
                    set = posProcess(selector, set);
                }
            }
        } else {
            if (!seed && parts.length > 1 && context.nodeType === 9 && !contextXML && Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1])) {
                var ret = Sizzle.find(parts.shift(), context, contextXML);
                context = ret.expr ? Sizzle.filter(ret.expr, ret.set)[0] : ret.set[0];
            }
            if (context) {
                var ret = seed ? {
                    expr: parts.pop(),
                    set: makeArray(seed)
                }: Sizzle.find(parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode: context, contextXML);
                set = ret.expr ? Sizzle.filter(ret.expr, ret.set) : ret.set;
                if (parts.length > 0) {
                    checkSet = makeArray(set);
                } else {
                    prune = false;
                }
                while (parts.length) {
                    var cur = parts.pop(),
                    pop = cur;
                    if (!Expr.relative[cur]) {
                        cur = "";
                    } else {
                        pop = parts.pop();
                    }
                    if (pop == null) {
                        pop = context;
                    }
                    Expr.relative[cur](checkSet, pop, contextXML);
                }
            } else {
                checkSet = parts = [];
            }
        }
        if (!checkSet) {
            checkSet = set;
        }
        if (!checkSet) {
            throw "Syntax error, unrecognized expression: " + (cur || selector);
        }
        if (toString.call(checkSet) === "[object Array]") {
            if (!prune) {
                results.push.apply(results, checkSet);
            } else if (context && context.nodeType === 1) {
                for (var i = 0; checkSet[i] != null; i++) {
                    if (checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i]))) {
                        results.push(set[i]);
                    }
                }
            } else {
                for (var i = 0; checkSet[i] != null; i++) {
                    if (checkSet[i] && checkSet[i].nodeType === 1) {
                        results.push(set[i]);
                    }
                }
            }
        } else {
            makeArray(checkSet, results);
        }
        if (extra) {
            Sizzle(extra, origContext, results, seed);
            Sizzle.uniqueSort(results);
        }
        return results;
    };
    Sizzle.uniqueSort = function(results) {
        if (sortOrder) {
            hasDuplicate = false;
            results.sort(sortOrder);
            if (hasDuplicate) {
                for (var i = 1; i < results.length; i++) {
                    if (results[i] === results[i - 1]) {
                        results.splice(i--, 1);
                    }
                }
            }
        }
    };
    Sizzle.matches = function(expr, set) {
        return Sizzle(expr, null, null, set);
    };
    Sizzle.find = function(expr, context, isXML) {
        var set, match;
        if (!expr) {
            return [];
        }
        for (var i = 0,
        l = Expr.order.length; i < l; i++) {
            var type = Expr.order[i],
            match;
            if ((match = Expr.match[type].exec(expr))) {
                var left = RegExp.leftContext;
                if (left.substr(left.length - 1) !== "\\") {
                    match[1] = (match[1] || "").replace(/\\/g, "");
                    set = Expr.find[type](match, context, isXML);
                    if (set != null) {
                        expr = expr.replace(Expr.match[type], "");
                        break;
                    }
                }
            }
        }
        if (!set) {
            set = context.getElementsByTagName("*");
        }
        return {
            set: set,
            expr: expr
        };
    };
    Sizzle.filter = function(expr, set, inplace, not) {
        var old = expr,
        result = [],
        curLoop = set,
        match,
        anyFound,
        isXMLFilter = set && set[0] && isXML(set[0]);
        while (expr && set.length) {
            for (var type in Expr.filter) {
                if ((match = Expr.match[type].exec(expr)) != null) {
                    var filter = Expr.filter[type],
                    found,
                    item;
                    anyFound = false;
                    if (curLoop == result) {
                        result = [];
                    }
                    if (Expr.preFilter[type]) {
                        match = Expr.preFilter[type](match, curLoop, inplace, result, not, isXMLFilter);
                        if (!match) {
                            anyFound = found = true;
                        } else if (match === true) {
                            continue;
                        }
                    }
                    if (match) {
                        for (var i = 0; (item = curLoop[i]) != null; i++) {
                            if (item) {
                                found = filter(item, match, i, curLoop);
                                var pass = not ^ !!found;
                                if (inplace && found != null) {
                                    if (pass) {
                                        anyFound = true;
                                    } else {
                                        curLoop[i] = false;
                                    }
                                } else if (pass) {
                                    result.push(item);
                                    anyFound = true;
                                }
                            }
                        }
                    }
                    if (found !== undefined) {
                        if (!inplace) {
                            curLoop = result;
                        }
                        expr = expr.replace(Expr.match[type], "");
                        if (!anyFound) {
                            return [];
                        }
                        break;
                    }
                }
            }
            if (expr == old) {
                if (anyFound == null) {
                    throw "Syntax error, unrecognized expression: " + expr;
                } else {
                    break;
                }
            }
            old = expr;
        }
        return curLoop;
    };
    var Expr = Sizzle.selectors = {
        order: ["ID", "NAME", "TAG"],
        match: {
            ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
            CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
            NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
            ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
            TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
            CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
            POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
            PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
        },
        attrMap: {
            "class": "className",
            "for": "htmlFor"
        },
        attrHandle: {
            href: function(elem) {
                return elem.getAttribute("href");
            }
        },
        relative: {
            "+": function(checkSet, part, isXML) {
                var isPartStr = typeof part === "string",
                isTag = isPartStr && !/\W/.test(part),
                isPartStrNotTag = isPartStr && !isTag;
                if (isTag && !isXML) {
                    part = part.toUpperCase();
                }
                for (var i = 0,
                l = checkSet.length,
                elem; i < l; i++) {
                    if ((elem = checkSet[i])) {
                        while ((elem = elem.previousSibling) && elem.nodeType !== 1) {}
                        checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? elem || false: elem === part;
                    }
                }
                if (isPartStrNotTag) {
                    Sizzle.filter(part, checkSet, true);
                }
            },
            ">": function(checkSet, part, isXML) {
                var isPartStr = typeof part === "string";
                if (isPartStr && !/\W/.test(part)) {
                    part = isXML ? part: part.toUpperCase();
                    for (var i = 0,
                    l = checkSet.length; i < l; i++) {
                        var elem = checkSet[i];
                        if (elem) {
                            var parent = elem.parentNode;
                            checkSet[i] = parent.nodeName === part ? parent: false;
                        }
                    }
                } else {
                    for (var i = 0,
                    l = checkSet.length; i < l; i++) {
                        var elem = checkSet[i];
                        if (elem) {
                            checkSet[i] = isPartStr ? elem.parentNode: elem.parentNode === part;
                        }
                    }
                    if (isPartStr) {
                        Sizzle.filter(part, checkSet, true);
                    }
                }
            },
            "": function(checkSet, part, isXML) {
                var doneName = done++,
                checkFn = dirCheck;
                if (!/\W/.test(part)) {
                    var nodeCheck = part = isXML ? part: part.toUpperCase();
                    checkFn = dirNodeCheck;
                }
                checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
            },
            "~": function(checkSet, part, isXML) {
                var doneName = done++,
                checkFn = dirCheck;
                if (typeof part === "string" && !/\W/.test(part)) {

                    var nodeCheck = part = isXML ? part: part.toUpperCase();
                    checkFn = dirNodeCheck;
                }
                checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
            }
        },
        find: {
            ID: function(match, context, isXML) {
                if (typeof context.getElementById !== "undefined" && !isXML) {
                    var m = context.getElementById(match[1]);
                    return m ? [m] : [];
                }
            },
            NAME: function(match, context, isXML) {
                if (typeof context.getElementsByName !== "undefined") {
                    var ret = [],
                    results = context.getElementsByName(match[1]);
                    for (var i = 0,
                    l = results.length; i < l; i++) {
                        if (results[i].getAttribute("name") === match[1]) {
                            ret.push(results[i]);
                        }
                    }
                    return ret.length === 0 ? null: ret;
                }
            },
            TAG: function(match, context) {
                return context.getElementsByTagName(match[1]);
            }
        },
        preFilter: {
            CLASS: function(match, curLoop, inplace, result, not, isXML) {
                match = " " + match[1].replace(/\\/g, "") + " ";
                if (isXML) {
                    return match;
                }
                for (var i = 0,
                elem; (elem = curLoop[i]) != null; i++) {
                    if (elem) {
                        if (not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0)) {
                            if (!inplace) result.push(elem);
                        } else if (inplace) {
                            curLoop[i] = false;
                        }
                    }
                }
                return false;
            },
            ID: function(match) {
                return match[1].replace(/\\/g, "");
            },
            TAG: function(match, curLoop) {
                for (var i = 0; curLoop[i] === false; i++) {}
                return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
            },
            CHILD: function(match) {
                if (match[1] == "nth") {
                    var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || !/\D/.test(match[2]) && "0n+" + match[2] || match[2]);
                    match[2] = (test[1] + (test[2] || 1)) - 0;
                    match[3] = test[3] - 0;
                }
                match[0] = done++;
                return match;
            },
            ATTR: function(match, curLoop, inplace, result, not, isXML) {
                var name = match[1].replace(/\\/g, "");
                if (!isXML && Expr.attrMap[name]) {
                    match[1] = Expr.attrMap[name];
                }
                if (match[2] === "~=") {
                    match[4] = " " + match[4] + " ";
                }
                return match;
            },
            PSEUDO: function(match, curLoop, inplace, result, not) {
                if (match[1] === "not") {
                    if (chunker.exec(match[3]).length > 1 || /^\w/.test(match[3])) {
                        match[3] = Sizzle(match[3], null, null, curLoop);
                    } else {
                        var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
                        if (!inplace) {
                            result.push.apply(result, ret);
                        }
                        return false;
                    }
                } else if (Expr.match.POS.test(match[0]) || Expr.match.CHILD.test(match[0])) {
                    return true;
                }
                return match;
            },
            POS: function(match) {
                match.unshift(true);
                return match;
            }
        },
        filters: {
            enabled: function(elem) {
                return elem.disabled === false && elem.type !== "hidden";
            },
            disabled: function(elem) {
                return elem.disabled === true;
            },
            checked: function(elem) {
                return elem.checked === true;
            },
            selected: function(elem) {
                elem.parentNode.selectedIndex;
                return elem.selected === true;
            },
            parent: function(elem) {
                return !! elem.firstChild;
            },
            empty: function(elem) {
                return ! elem.firstChild;
            },
            has: function(elem, i, match) {
                return !! Sizzle(match[3], elem).length;
            },
            header: function(elem) {
                return /h\d/i.test(elem.nodeName);
            },
            text: function(elem) {
                return "text" === elem.type;
            },
            radio: function(elem) {
                return "radio" === elem.type;
            },
            checkbox: function(elem) {
                return "checkbox" === elem.type;
            },
            file: function(elem) {
                return "file" === elem.type;
            },
            password: function(elem) {
                return "password" === elem.type;
            },
            submit: function(elem) {
                return "submit" === elem.type;
            },
            image: function(elem) {
                return "image" === elem.type;
            },
            reset: function(elem) {
                return "reset" === elem.type;
            },
            button: function(elem) {
                return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
            },
            input: function(elem) {
                return /input|select|textarea|button/i.test(elem.nodeName);
            }
        },
        setFilters: {
            first: function(elem, i) {
                return i === 0;
            },
            last: function(elem, i, match, array) {
                return i === array.length - 1;
            },
            even: function(elem, i) {
                return i % 2 === 0;
            },
            odd: function(elem, i) {
                return i % 2 === 1;
            },
            lt: function(elem, i, match) {
                return i < match[3] - 0;
            },
            gt: function(elem, i, match) {
                return i > match[3] - 0;
            },
            nth: function(elem, i, match) {
                return match[3] - 0 == i;
            },
            eq: function(elem, i, match) {
                return match[3] - 0 == i;
            }
        },
        filter: {
            PSEUDO: function(elem, match, i, array) {
                var name = match[1],
                filter = Expr.filters[name];
                if (filter) {
                    return filter(elem, i, match, array);
                } else if (name === "contains") {
                    return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
                } else if (name === "not") {
                    var not = match[3];
                    for (i = 0, l = not.length; i < l; i++) {
                        if (not[i] === elem) {
                            return false;
                        }
                    }
                    return true;
                }
            },
            CHILD: function(elem, match) {
                var type = match[1],
                node = elem;
                switch (type) {
                case 'only':
                case 'first':
                    while ((node = node.previousSibling)) {
                        if (node.nodeType === 1) {
                            return false;
                        }
                    }
                    if (type == 'first') {
                        return true;
                    }
                    node = elem;
                case 'last':
                    while ((node = node.nextSibling)) {
                        if (node.nodeType === 1) return false;
                    }
                    return true;
                case 'nth':
                    var first = match[2],
                    last = match[3];
                    if (first == 1 && last == 0) {
                        return true;
                    }
                    var doneName = match[0],
                    parent = elem.parentNode;
                    if (parent && (parent.sizcache !== doneName || !elem.nodeIndex)) {
                        var count = 0;
                        for (node = parent.firstChild; node; node = node.nextSibling) {
                            if (node.nodeType === 1) {
                                node.nodeIndex = ++count;
                            }
                        }
                        parent.sizcache = doneName;
                    }
                    var diff = elem.nodeIndex - last;
                    if (first == 0) {
                        return diff == 0;
                    } else {
                        return (diff % first == 0 && diff / first >= 0);
                    }
                }
            },
            ID: function(elem, match) {
                return elem.nodeType === 1 && elem.getAttribute("id") === match;
            },
            TAG: function(elem, match) {
                return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
            },
            CLASS: function(elem, match) {
                return (" " + (elem.className || elem.getAttribute("class")) + " ").indexOf(match) > -1;
            },
            ATTR: function(elem, match) {
                var name = match[1],
                result = Expr.attrHandle[name] ? Expr.attrHandle[name](elem) : elem[name] != null ? elem[name] : elem.getAttribute(name),
                value = result + "",
                type = match[2],
                check = match[4];
                return result == null ? type === "!=": type === "=" ? value === check: type === "*=" ? value.indexOf(check) >= 0 : type === "~=" ? (" " + value + " ").indexOf(check) >= 0 : !check ? value && result !== false: type === "!=" ? value != check: type === "^=" ? value.indexOf(check) === 0 : type === "$=" ? value.substr(value.length - check.length) === check: type === "|=" ? value === check || value.substr(0, check.length + 1) === check + "-": false;
            },
            POS: function(elem, match, i, array) {
                var name = match[2],
                filter = Expr.setFilters[name];
                if (filter) {
                    return filter(elem, i, match, array);
                }
            }
        }
    };
    var origPOS = Expr.match.POS;
    for (var type in Expr.match) {
        Expr.match[type] = new RegExp(Expr.match[type].source + /(?![^\[]*\])(?![^\(]*\))/.source);
    }
    var makeArray = function(array, results) {
        array = Array.prototype.slice.call(array);
        if (results) {
            results.push.apply(results, array);
            return results;
        }
        return array;
    };
    try {
        Array.prototype.slice.call(document.documentElement.childNodes);
    } catch(e) {
        makeArray = function(array, results) {
            var ret = results || [];
            if (toString.call(array) === "[object Array]") {
                Array.prototype.push.apply(ret, array);
            } else {
                if (typeof array.length === "number") {
                    for (var i = 0,
                    l = array.length; i < l; i++) {
                        ret.push(array[i]);
                    }
                } else {
                    for (var i = 0; array[i]; i++) {
                        ret.push(array[i]);
                    }
                }
            }
            return ret;
        };
    }
    var sortOrder;
    if (document.documentElement.compareDocumentPosition) {
        sortOrder = function(a, b) {
            var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
            if (ret === 0) {
                hasDuplicate = true;
            }
            return ret;
        };
    } else if ("sourceIndex" in document.documentElement) {
        sortOrder = function(a, b) {
            var ret = a.sourceIndex - b.sourceIndex;
            if (ret === 0) {
                hasDuplicate = true;
            }
            return ret;
        };
    } else if (document.createRange) {
        sortOrder = function(a, b) {
            var aRange = a.ownerDocument.createRange(),
            bRange = b.ownerDocument.createRange();
            aRange.selectNode(a);
            aRange.collapse(true);
            bRange.selectNode(b);
            bRange.collapse(true);
            var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
            if (ret === 0) {
                hasDuplicate = true;
            }
            return ret;
        };
    } (function() {
        var form = document.createElement("div"),
        id = "script" + (new Date).getTime();
        form.innerHTML = "<a name='" + id + "'/>";
        var root = document.documentElement;
        root.insertBefore(form, root.firstChild);
        if ( !! document.getElementById(id)) {
            Expr.find.ID = function(match, context, isXML) {
                if (typeof context.getElementById !== "undefined" && !isXML) {
                    var m = context.getElementById(match[1]);
                    return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined: [];
                }
            };
            Expr.filter.ID = function(elem, match) {
                var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
                return elem.nodeType === 1 && node && node.nodeValue === match;
            };
        }
        root.removeChild(form);
        root = form = null;
    })(); (function() {
        var div = document.createElement("div");
        div.appendChild(document.createComment(""));
        if (div.getElementsByTagName("*").length > 0) {
            Expr.find.TAG = function(match, context) {
                var results = context.getElementsByTagName(match[1]);
                if (match[1] === "*") {
                    var tmp = [];
                    for (var i = 0; results[i]; i++) {
                        if (results[i].nodeType === 1) {
                            tmp.push(results[i]);
                        }
                    }
                    results = tmp;
                }
                return results;
            };
        }
        div.innerHTML = "<a href='#'></a>";
        if (div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && div.firstChild.getAttribute("href") !== "#") {
            Expr.attrHandle.href = function(elem) {
                return elem.getAttribute("href", 2);
            };
        }
        div = null;
    })();
    if (document.querySelectorAll)(function() {
        var oldSizzle = Sizzle,
        div = document.createElement("div");
        div.innerHTML = "<p class='TEST'></p>";
        if (div.querySelectorAll && div.querySelectorAll(".TEST").length === 0) {
            return;
        }
        Sizzle = function(query, context, extra, seed) {
            context = context || document;
            if (!seed && context.nodeType === 9 && !isXML(context)) {
                try {
                    return makeArray(context.querySelectorAll(query), extra);
                } catch(e) {}
            }
            return oldSizzle(query, context, extra, seed);
        };
        for (var prop in oldSizzle) {
            Sizzle[prop] = oldSizzle[prop];
        }
        div = null;
    })();
    if (document.getElementsByClassName && document.documentElement.getElementsByClassName)(function() {
        var div = document.createElement("div");
        div.innerHTML = "<div class='test e'></div><div class='test'></div>";
        if (div.getElementsByClassName("e").length === 0) return;
        div.lastChild.className = "e";
        if (div.getElementsByClassName("e").length === 1) return;
        Expr.order.splice(1, 0, "CLASS");
        Expr.find.CLASS = function(match, context, isXML) {
            if (typeof context.getElementsByClassName !== "undefined" && !isXML) {
                return context.getElementsByClassName(match[1]);
            }
        };
        div = null;
    })();
    function dirNodeCheck(dir, cur, doneName, checkSet, nodeCheck, isXML) {
        var sibDir = dir == "previousSibling" && !isXML;
        for (var i = 0,
        l = checkSet.length; i < l; i++) {
            var elem = checkSet[i];
            if (elem) {
                if (sibDir && elem.nodeType === 1) {
                    elem.sizcache = doneName;
                    elem.sizset = i;
                }
                elem = elem[dir];
                var match = false;
                while (elem) {
                    if (elem.sizcache === doneName) {
                        match = checkSet[elem.sizset];
                        break;
                    }
                    if (elem.nodeType === 1 && !isXML) {
                        elem.sizcache = doneName;
                        elem.sizset = i;
                    }
                    if (elem.nodeName === cur) {
                        match = elem;
                        break;
                    }
                    elem = elem[dir];
                }
                checkSet[i] = match;
            }
        }
    }
    function dirCheck(dir, cur, doneName, checkSet, nodeCheck, isXML) {
        var sibDir = dir == "previousSibling" && !isXML;
        for (var i = 0,
        l = checkSet.length; i < l; i++) {
            var elem = checkSet[i];
            if (elem) {
                if (sibDir && elem.nodeType === 1) {
                    elem.sizcache = doneName;
                    elem.sizset = i;
                }
                elem = elem[dir];
                var match = false;
                while (elem) {
                    if (elem.sizcache === doneName) {
                        match = checkSet[elem.sizset];
                        break;
                    }
                    if (elem.nodeType === 1) {
                        if (!isXML) {
                            elem.sizcache = doneName;
                            elem.sizset = i;
                        }
                        if (typeof cur !== "string") {
                            if (elem === cur) {
                                match = true;
                                break;
                            }
                        } else if (Sizzle.filter(cur, [elem]).length > 0) {
                            match = elem;
                            break;
                        }
                    }
                    elem = elem[dir];
                }
                checkSet[i] = match;
            }
        }
    }
    var contains = document.compareDocumentPosition ?
    function(a, b) {
        return a.compareDocumentPosition(b) & 16;
    }: function(a, b) {
        return a !== b && (a.contains ? a.contains(b) : true);
    };
    var isXML = function(elem) {
        return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML";
    };
    var posProcess = function(selector, context) {
        var tmpSet = [],
        later = "",
        match,
        root = context.nodeType ? [context] : context;
        while ((match = Expr.match.PSEUDO.exec(selector))) {
            later += match[0];
            selector = selector.replace(Expr.match.PSEUDO, "");
        }
        selector = Expr.relative[selector] ? selector + "*": selector;
        for (var i = 0,
        l = root.length; i < l; i++) {
            Sizzle(selector, root[i], tmpSet);
        }
        return Sizzle.filter(later, tmpSet);
    };
    QZFL.selector = Sizzle;
    QZFL.object.makeArray = makeArray;
    QZFL.dom.uniqueSort = Sizzle.uniqueSort;
    QZFL.dom.contains = contains;
})();
QZFL.string.parseXML = function(text) {
    var doc;
    if (window.ActiveXObject) {
        doc = QZFL.lang.tryThese(function() {
            return new ActiveXObject('MSXML2.DOMDocument.6.0');
        },
        function() {
            return new ActiveXObject('MSXML2.DOMDocument.5.0');
        },
        function() {
            return new ActiveXObject('MSXML2.DOMDocument.4.0');
        },
        function() {
            return new ActiveXObject('MSXML2.DOMDocument.3.0');
        },
        function() {
            return new ActiveXObject('MSXML2.DOMDocument');
        },
        function() {
            return new ActiveXObject('Microsoft.XMLDOM');
        });
        doc.async = "false";
        doc.loadXML(text);
        if (doc.parseError.reason) {
            return null;
        }
    } else {
        var parser = new DOMParser();
        doc = parser.parseFromString(text, "text/xml");
        if (doc.documentElement.nodeName == 'parsererror') {
            return null;
        }
    }
    return doc.documentElement;
};
QZFL.string.timeFormatString = function(date, mask, baseTime) {
    typeof(date) == 'number' && (date = new Date(date));
    if (isNaN(date) || !date instanceof Date) {
        return '';
    }
    try {
        date.getTime();
    } catch(e) {
        return '';
    }
    if (typeof(mask) !== 'string') {
        return s + '';
    }
    baseTime = baseTime || 0;
    var me = QZFL.string.timeFormatString,
    map = me._map,
    isRelative = false,
    v;
    return mask.replace(me._re,
    function(a, b, c) { (isRelative = b.charAt(0) == '_') && (b = b.charAt(1));
        if (!map[b]) {
            return a;
        }
        if (isRelative == false) {
            v = date[map[b][0]]();
            b == 'y' && (v %= 100);
            b == 'M' && v++;
            return v < 10 ? QZFL.string.fillLength(v, 2, c) : v.toString();
        } else {
            return Math.floor(Math.abs(date - baseTime) / map[b][1]);
        }
    });
};
QZFL.string.timeFormatString._re = /\{([_yYMdhms]{1,2})(?:\:([\d\w\s]))?\}/g;
QZFL.string.timeFormatString._map = {
    y: ['getYear', 31104000000],
    Y: ['getFullYear', 31104000000],
    M: ['getMonth', 2592000000],
    d: ['getDate', 86400000],
    h: ['getHours', 3600000],
    m: ['getMinutes', 60000],
    s: ['getSeconds', 1000]
};
QZFL.string.StringBuilder = function() {
    this._strList = QZFL.lang.arg2arr(arguments);
};
QZFL.string.StringBuilder.prototype = {
    append: function(str) {
        if (QZFL.lang.isString(str)) {
            this._strList.push(str.toString());
        }
    },
    insertFirst: function(str) {
        if (QZFL.lang.isString(str)) {
            this._strList.unshift(str.toString());
        }
    },
    appendArray: function(arr) {
        if (isArray(arr)) {
            this._strList = this._strList.concat(arr);
        }
    },
    toString: function(spliter) {
        return this._strList.join(!spliter ? '': spliter);
    },
    clear: function() {
        this._strList.splice(0, this._strList.length);
    }
};
QZFL.lang.isValidXMLdom = function(o) {
    return !! (o && o.xml && /^<\?xml/.test(o.xml));
};
QZFL.lang.arg2arr = function(refArgs, start) {
    return Array.prototype.slice.apply(refArgs, [start || 0, refArgs.length]);
};
QZFL.lang.getObjByNameSpace = function(ns, setup) {
    if (typeof(ns) != 'string') {
        return ns;
    }
    var l = ns.split("."),
    r = window;
    try {
        for (var i = 0,
        len = l.length; i < len; ++i) {
            if (typeof(r[l[i]]) == 'undefined') {
                if (setup) {
                    r[l[i]] = {};
                } else {
                    return void(0);
                }
            }
            r = r[l[i]];
        }
        return r;
    } catch(ignore) {
        return void(0);
    }
};
QZFL.lang.objectClone = function(obj, preventName) {
    if ((typeof obj) == 'object') {
        var res = (QZFL.lang.isArray(obj)) ? [] : {};
        for (var i in obj) {
            if (i != preventName) res[i] = QZFL.lang.objectClone(obj[i], preventName);
        }
        return res;
    } else if ((typeof obj) == 'function') {
        return Object;
    }
    return obj;
};
QZFL.lang.obj2str = function(obj) {
    var t, sw;
    if ((typeof obj) == 'object') {
        if (obj === null) {
            return 'null';
        }
        sw = QZFL.lang.isArray(obj);
        t = [];
        for (var i in obj) {
            t.push((sw ? "": ("\"" + QZFL.string.escString(i) + "\":")) + obj2str(obj[i]));
        }
        t = t.join();
        return sw ? ("[" + t + "]") : ("{" + t + "}");
    } else if ((typeof obj) == 'function') {
        return '';
    } else if ((typeof obj) == 'undefined') {
        return 'undefined';
    } else if ((typeof obj) == 'number') {
        return obj.toString();
    }
    return ! obj ? "\"\"": ("\"" + QZFL.string.escString(obj) + "\"");
};
QZFL.lang.propertieCopy = function(s, b, propertiSet, notOverWrite) {
    var l = (!propertiSet || typeof(propertiSet) != 'object') ? b: propertiSet;
    s = s || {};
    for (var p in l) {
        if (!notOverWrite || !(p in s)) {
            s[p] = l[p];
        }
    }
    return s;
};
QZFL.lang.tryThese = function() {
    for (var res, i = 0,
    len = arguments.length; i < len; i++) {
        try {
            return arguments[i]();
        } catch(ignore) {}
    }
    return null;
};
QZFL.lang.chain = function(u, v) {
    var calls = Array.prototype.slice.call(arguments);
    return function() {
        for (var i = 0,
        len = calls.length; i < len; i++) {
            if (calls[i] && calls[i].apply(null, arguments) === false) {
                return false;
            }
        }
        return true;
    };
};
QZFL.lang.uniqueArray = function(arr) {
    if (!QZFL.lang.isArray(arr)) {
        return arr;
    }
    var flag = {},
    index = 0;
    while (index < arr.length) {
        if (flag[arr[index]] == typeof(arr[index])) {
            arr.splice(index, 1);
            continue;
        }
        flag[arr[index].toString()] = typeof(arr[index]); ++index;
    }
    return arr;
};
QZFL.XHR = function(actionURL, cname, method, data, isAsync, nocache) {
    if (!cname) {
        cname = "_xhrInstence_" + (QZFL.XHR.counter + 1);
    }
    var prot;
    if (QZFL.XHR.instance[cname] instanceof QZFL.XHR) {
        prot = QZFL.XHR.instance[cname];
    } else {
        prot = (QZFL.XHR.instance[cname] = this);
        QZFL.XHR.counter++;
    }
    prot._name = cname;
    prot._nc = !!nocache;
    prot._method = (QZFL.object.getType(method) != "string" || method.toUpperCase() != "GET") ? "POST": (method = "GET");
    prot._isAsync = (!(isAsync === false)) ? true: isAsync;
    prot._uri = actionURL;
    prot._data = (QZFL.object.getType(data) == "object" || QZFL.object.getType(data) == 'string') ? data: {};
    prot._sender = null;
    prot._isHeaderSetted = false;
    prot._xmlQueue = QZFL.queue("xhr" + cname, [function() {
        return new XMLHttpRequest();
    },
    function() {
        return new ActiveXObject("Msxml2.XMLHTTP");
    },
    function() {
        return new ActiveXObject("Microsoft.XMLHTTP");
    }]);
    this.onSuccess = QZFL.emptyFn;
    this.onError = QZFL.emptyFn;
    this.charset = "gb2312";
    this.proxyPath = "";
    return prot;
};
QZFL.XHR.instance = {};
QZFL.XHR.counter = 0;
QZFL.XHR._errCodeMap = {
    400 : {
        msg: 'Bad Request'
    },
    401 : {
        msg: 'Unauthorized'
    },
    403 : {
        msg: 'Forbidden'
    },
    404 : {
        msg: 'Not Found'
    },
    999 : {
        msg: 'Proxy page error'
    },
    1000 : {
        msg: 'Bad Response'
    },
    1001 : {
        msg: 'No Network'
    },
    1002 : {
        msg: 'No Data'
    },
    1003 : {
        msg: 'Eval Error'
    }
};
QZFL.XHR.xsend = function(o, uri) {
    if (! (o instanceof QZFL.XHR)) {
        return false;
    }
    if (QZFL.userAgent.firefox && QZFL.userAgent.firefox < 3) {
        return false;
    }
    function clear(obj) {
        try {
            obj._sender = obj._sender.callback = obj._sender.errorCallback = obj._sender.onreadystatechange = null;
        } catch(ignore) {}
        if (QZFL.userAgent.safari || QZFL.userAgent.opera) {
            setTimeout('QZFL.dom.removeElement($("_xsend_frm_' + obj._name + '"))', 50);
        } else {
            QZFL.dom.removeElement($("_xsend_frm_" + obj._name));
        }
    }
    if (o._sender === null || o._sender === void(0)) {
        var sender = document.createElement("iframe");
        sender.id = "_xsend_frm_" + o._name;
        sender.style.width = sender.style.height = sender.style.borderWidth = "0";
        document.body.appendChild(sender);
        sender.callback = QZFL.event.bind(o,
        function(data) {
            o.onSuccess(data);
            clear(o);
        });
        sender.errorCallback = QZFL.event.bind(o,
        function(num) {
            o.onError(QZFL.XHR._errCodeMap[num]);
            clear(o);
        });
        o._sender = sender;
    }
    var tmp = QZFL.config.gbEncoderPath;
    o.GBEncoderPath = tmp ? tmp: "";
    o._sender.src = uri.protocol + "://" + uri.host + (this.proxyPath ? this.proxyPath: "/xhr_proxy_gbk.html");
    return true;
};
QZFL.XHR.genHttpParamString = function(o, cs) {
    cs = (cs || "gb2312").toLowerCase();
    var r = [];
    for (var i in o) {
        r.push(i + "=" + ((cs == "utf-8") ? encodeURIComponent(o[i]) : QZFL.string.URIencode(o[i])));
    }
    return r.join("&");
};
QZFL.XHR.prototype.send = function() {
    if (this._method == 'POST' && this._data == null) {
        return false;
    }
    var u = new QZFL.util.URI(this._uri);
    if (u == null) {
        return false;
    }
    this._uri = u.href;
    if (QZFL.object.getType(this._data) == "object") {
        this._data = QZFL.XHR.genHttpParamString(this._data, this.charset);
    }
    if (this._method == 'GET' && this._data) {
        this._uri += (this._uri.indexOf("?") < 0 ? "?": "&") + this._data;
    }
    if (u.host != location.host) {
        return QZFL.XHR.xsend(this, u);
    }
    if (this._sender === null || this._sender === void(0)) {
        var sender = (function() {
            if (!this._xmlQueue.getLen()) {
                return null;
            }
            var _xhr = this._xmlQueue.shift();
            if (_xhr) {
                return _xhr;
            } else {
                return arguments.callee.call(this);
            }
        }).call(this);
        if (!sender) {
            return false;
        }
        this._sender = sender;
    }
    try {
        this._sender.open(this._method, this._uri, this._isAsync);
    } catch(err) {
        return false;
    }
    if (this._method == 'POST' && !this._isHeaderSetted) {
        this._sender.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        this._isHeaderSetted = true;
    }
    if (this._nc) {
        this._sender.setRequestHeader('If-Modified-Since', 'Thu, 1 Jan 1970 00:00:00 GMT');
        this._sender.setRequestHeader('Cache-Control', 'no-cache');
    }
    this._sender.onreadystatechange = QZFL.event.bind(this,
    function() {
        try {
            if (this._sender.readyState == 4) {
                if (this._sender.status >= 200 && this._sender.status < 300) {
                    this.onSuccess({
                        text: this._sender.responseText,
                        xmlDom: this._sender.responseXML
                    });
                } else {
                    if (QZFL.userAgent.safari && (QZFL.object.getType(this._sender.status) == 'undefined')) {
                        this.onError(QZFL.XHR._errCodeMap[1002]);
                    } else {
                        this.onError(QZFL.XHR._errCodeMap[this._sender.status]);
                    }
                }
                delete this._sender;
                this._sender = null;
            }
        } catch(err) {}
    });
    this._sender.send((this._method == 'POST' ? this._data: void(0)));
    return true;
};
QZFL.XHR.prototype.destroy = function() {
    var n = this._name;
    delete QZFL.XHR.instance[n]._sender;
    QZFL.XHR.instance[n]._sender = null;
    delete QZFL.XHR.instance[n];
    QZFL.XHR.counter--;
    return null;
};
QZFL.FormSender = function(actionURL, method, data, charset) {
    this.name = "_fpInstence_" + QZFL.FormSender.counter;
    QZFL.FormSender.instance[this.name] = this;
    QZFL.FormSender.counter++;
    this.method = method || "POST";
    this.uri = actionURL;
    this.data = (typeof(data) == "object" || typeof(data) == 'string') ? data: null;
    this.proxyURL = (typeof(charset) == 'string' && charset.toUpperCase() == "UTF-8") ? QZFL.config.FSHelperPage.replace(/_gbk/, "_utf8") : QZFL.config.FSHelperPage;
    this._sender = null;
    this.onSuccess = QZFL.emptyFn;
    this.onError = QZFL.emptyFn;
};
QZFL.FormSender.instance = {};
QZFL.FormSender.counter = 0;
QZFL.FormSender._errCodeMap = {
    999 : {
        msg: 'Connection or Server error'
    }
};
QZFL.FormSender.pluginsPool = {
    "formHandler": []
};
QZFL.FormSender._pluginsRunner = function(pType, data) {
    var _s = QZFL.FormSender,
    l = _s.pluginsPool[pType],
    t = data,
    len;
    if (l && (len = l.length)) {
        for (var i = 0; i < len; ++i) {
            if (typeof(l[i]) == "function") {
                t = l[i](t);
            }
        }
    }
    return t;
};
QZFL.FormSender.prototype.send = function() {
    if (this.method == 'POST' && this.data == null) {
        return false;
    }
    function clear(o) {
        o._sender = o._sender.callback = o._sender.errorCallback = o._sender.onreadystatechange = null;
        if (QZFL.userAgent.safari || QZFL.userAgent.opera) {
            setTimeout('QZFL.dom.removeElement(document.getElementById("_fp_frm_' + o.name + '"))', 50);
        } else {
            QZFL.dom.removeElement(document.getElementById("_fp_frm_" + o.name));
        }
    }
    if (this._sender === null || this._sender === void(0)) {
        var sender = document.createElement("iframe");
        sender.id = "_fp_frm_" + this.name;
        sender.style.cssText = "width:0;height:0;border-width:0;display:none;";
        document.body.appendChild(sender);
        sender.callback = QZFL.event.bind(this,
        function(o) {
            clearTimeout(timer);
            this.onSuccess(o);
            clear(this);
        });
        sender.errorCallback = QZFL.event.bind(this,
        function(o) {
            clearTimeout(timer);
            this.onError(o);
            clear(this);
        });
        if (typeof(sender.onreadystatechange) != 'undefined') {
            sender.onreadystatechange = QZFL.event.bind(this,
            function() {
                if (this._sender.readyState == 'complete' && this._sender.submited) {
                    clear(this);
                    this.onError(QZFL.FormSender._errCodeMap[999]);
                }
            });
        } else {
            var timer = setTimeout(QZFL.event.bind(this,
            function() {
                try {
                    var _t = this._sender.contentWindow.location.href;
                    if (_t.indexOf(this.uri) == 0) {
                        clearTimeout(timer);
                        clear(this);
                        this.onError(QZFL.FormSender._errCodeMap[999]);
                    }
                } catch(err) {
                    clearTimeout(timer);
                    clear(this);
                    this.onError(QZFL.FormSender._errCodeMap[999]);
                }
            }), 200);
        }
        this._sender = sender;
    }
    this._sender.src = this.proxyURL;
    return true;
};
QZFL.FormSender.prototype.destroy = function() {
    var n = this.name;
    delete QZFL.FormSender.instance[n]._sender;
    QZFL.FormSender.instance[n]._sender = null;
    delete QZFL.FormSender.instance[n];
    QZFL.FormSender.counter--;
    return null;
};
QZFL.JsLoader = function(isDebug) {
    this.debug = isDebug || (QZFL.config.debugLevel > 1);
    this.onload = QZFL.emptyFn;
    this.onerror = QZFL.emptyFn;
};
QZFL.JsLoader.prototype.load = function(src, doc, opt) {
    var opts = {},
    t = typeof(opt),
    o = this;
    if (t == "string") {
        opts.charset = opt;
    } else if (t == "object") {
        opts = opt;
    }
    opts.charset = opts.charset || "gb2312";
    setTimeout(function() {
        o._load.apply(o, [src, doc || document, opts]);
        o = null;
    },
    0);
};
QZFL.JsLoader.prototype._load = function(src, doc, opts) {
    var _ie = QZFL.userAgent.ie,
    _js = doc.createElement("script"),
    o = this,
    _rm = QZFL.dom.removeElement,
    _ae = QZFL.event.addEvent,
    tmp,
    k;
    _ae(_js, (_ie ? "readystatechange": "load"),
    function() {
        if (!_js || _ie && !(_js.readyState == 'loaded')) {
            return;
        }
        o.onload();
        if (!o.debug) {
            _rm(_js);
        }
        _js = _rm = _ae = o = null;
    });
    if (!_ie) {
        _ae(_js, 'error',
        function() {
            o.onerror();
            if (!o.debug) {
                _rm(_js);
            }
            _js = _rm = _ae = o = null;
        })
    }
    for (k in opts) {
        if (typeof(tmp = opts[k]) == "string" && k.toLowerCase() != "src") {
            _js.setAttribute(k, tmp);
        }
    }
    doc.getElementsByTagName("head")[0].appendChild(_js);
    _js.src = src;
    opts = null;
};
QZFL["js" + "Loader"] = QZFL.JsLoader;
QZFL.JSONGetter = function(actionURL, cname, data, charset, junctionMode) {
    if (QZFL.object.getType(cname) != "string") {
        cname = "_jsonInstence_" + (QZFL.JSONGetter.counter + 1);
    }
    var prot = QZFL.JSONGetter.instance[cname];
    if (prot instanceof QZFL.JSONGetter) {} else {
        QZFL.JSONGetter.instance[cname] = prot = this;
        QZFL.JSONGetter.counter++;
        prot._name = cname;
        prot._sender = null;
        prot._timer = null;
        this.onSuccess = QZFL.emptyFn;
        this.onError = QZFL.emptyFn;
        this.onTimeout = QZFL.emptyFn;
        this.timeout = 5000;
        this.clear = QZFL.emptyFn;
        this._baseClear = function() {
            this._waiting = false;
            this._squeue = [];
            this._equeue = [];
            this.onSuccess = this.onError = QZFL.emptyFn;
            this.clear = null;
        };
    }
    prot._uri = actionURL;
    prot._data = (data && (QZFL.object.getType(data) == "object" || QZFL.object.getType(data) == "string")) ? data: null;
    prot._charset = (QZFL.object.getType(charset) != 'string') ? QZFL.config.defaultDataCharacterSet: charset;
    prot._jMode = !!junctionMode;
    return prot;
};
QZFL.JSONGetter.instance = {};
QZFL.JSONGetter.counter = 0;
QZFL.JSONGetter._errCodeMap = {
    999 : {
        msg: 'Connection or Server error.'
    },
    998 : {
        msg: 'Connection to Server timeout.'
    }
};
QZFL.JSONGetter.genHttpParamString = function(o) {
    var r = [];
    for (var i in o) {
        r.push(i + "=" + encodeURIComponent(o[i]));
    }
    return r.join("&");
};
QZFL.JSONGetter.prototype.addOnSuccess = function(f) {
    if (typeof(f) == "function") {
        if (this._squeue && this._squeue.push) {} else {
            this._squeue = [];
        }
        this._squeue.push(f);
    }
};
QZFL.JSONGetter._runFnQueue = function(q, resultArgs, th) {
    var f;
    if (q && q.length) {
        while (q.length > 0) {
            f = q.shift();
            if (typeof(f) == "function") {
                f.apply(th ? th: null, resultArgs);
            }
        }
    }
};
QZFL.JSONGetter.prototype.addOnError = function(f) {
    if (typeof(f) == "function") {
        if (this._equeue && this._equeue.push) {} else {
            this._equeue = [];
        }
        this._equeue.push(f);
    }
};
QZFL.JSONGetter.pluginsPool = {
    "srcStringHandler": []
};
QZFL.JSONGetter._pluginsRunner = function(pType, data) {
    var _s = QZFL.JSONGetter,
    l = _s.pluginsPool[pType],
    t = data,
    len;
    if (l && (len = l.length)) {
        for (var i = 0; i < len; ++i) {
            if (typeof(l[i]) == "function") {
                t = l[i](t);
            }
        }
    }
    return t;
};
QZFL.JSONGetter.prototype.send = function(callbackFnName) {
    if (this._waiting) {
        return;
    }
    var cfn = (QZFL.object.getType(callbackFnName) != 'string') ? "callback": callbackFnName,
    clear,
    da = this._uri;
    if (this._data) {
        da += (da.indexOf("?") < 0 ? "?": "&") + ((typeof(this._data) == "object") ? QZFL.JSONGetter.genHttpParamString(this._data) : this._data);
    }
    da = QZFL.JSONGetter._pluginsRunner("srcStringHandler", da);
    if (this._jMode) {
        window[cfn] = this.onSuccess;
        var _sd = new QZFL.JsLoader();
        _sd.onerror = this.onError;
        _sd.load(da, void(0), this._charset);
        return;
    }
    this._timer = setTimeout((function(th) {
        return function() {
            th.onTimeout();
        };
    })(this), this.timeout);
    if (QZFL.userAgent.ie) {
        if (QZFL.userAgent.beta && navigator.appVersion.indexOf("Trident\/4.0") > -1) {
            var _hf = new ActiveXObject("htmlfile");
            this.clear = clear = function(o) {
                clearTimeout(o._timer);
                if (o._sender) {
                    o._sender.close();
                    o._sender.parentWindow[cfn] = o._sender.parentWindow["errorCallback"] = null;
                    o._sender = null;
                }
                o._baseClear();
            };
            this._sender = _hf;
            var _cb = (function(th) {
                return (function() {
                    setTimeout((function(_o, _a) {
                        return (function() {
                            th._waiting = false;
                            _o.onSuccess.apply(_o, _a);
                            QZFL.JSONGetter._runFnQueue(th._squeue, _a, th);
                            clear(_o);
                        })
                    })(th, arguments), 0);
                });
            })(this);
            var _ecb = (function(th) {
                return (function() {
                    th._waiting = false;
                    var _eo = QZFL.JSONGetter._errCodeMap[999];
                    th.onError(_eo);
                    QZFL.JSONGetter._runFnQueue(th._equeue, [_eo], th);
                    clear(th);
                });
            })(this);
            _hf.open();
            _hf.parentWindow[cfn] = function() {
                _cb.apply(null, arguments);
            };
            _hf.parentWindow["errorCallback"] = _ecb;
            this._waiting = true;
            _hf.write("<script src=\"" + da + "\" charset=\"" + this._charset + "\"><\/script><script defer>setTimeout(\"try{errorCallback();}catch(ign){}\",0)<\/script>");
        } else {
            var df = document.createDocumentFragment(),
            sender = (QZFL.userAgent.ie == 9 ? document: df).createElement("script");
            sender.charset = this._charset;
            this._senderDoc = df;
            this._sender = sender;
            this.clear = clear = function(o) {
                clearTimeout(o._timer);
                if (o._sender) {
                    o._sender.onreadystatechange = null;
                }
                df = o._senderDoc = o._sender = null;
                o._baseClear();
            };
            df[cfn] = (function(th) {
                return (function() {
                    th._waiting = false;
                    th.onSuccess.apply(th, arguments);
                    QZFL.JSONGetter._runFnQueue(th._squeue, arguments, th);
                    clear(th);
                });
            })(this);
            sender.onreadystatechange = (function(th) {
                return (function() {
                    if (th._sender && th._sender.readyState == "loaded") {
                        try {
                            th._waiting = false;
                            var _eo = QZFL.JSONGetter._errCodeMap[999];
                            th.onError(_eo);
                            QZFL.JSONGetter._runFnQueue(th._equeue, [_eo], th);
                            clear(th);
                        } catch(ignore) {}
                    }
                });
            })(this);
            this._waiting = true;
            df.appendChild(sender);
            this._sender.src = da;
        }
    } else {
        this.clear = clear = function(o) {
            clearTimeout(o._timer);
            if (o._sender) {
                o._sender.src = "about:blank";
                o._sender = o._sender.callback = o._sender.errorCallback = null;
            }
            if (QZFL.userAgent.safari || QZFL.userAgent.opera) {
                setTimeout('QZFL.dom.removeElement($("_JSON_frm_' + o._name + '"))', 50);
            } else {
                QZFL.dom.removeElement($("_JSON_frm_" + o._name));
            }
            o._baseClear();
        };
        var _cb = (function(th) {
            return (function() {
                th._waiting = false;
                th.onSuccess.apply(th, arguments);
                QZFL.JSONGetter._runFnQueue(th._squeue, arguments, th);
                clear(th);
            });
        })(this);
        var _ecb = (function(th) {
            return (function() {
                th._waiting = false;
                var _eo = QZFL.JSONGetter._errCodeMap[999];
                th.onError(_eo);
                QZFL.JSONGetter._runFnQueue(th._equeue, [_eo], th);
                clear(th);
            });
        })(this);
        var frm = document.createElement("iframe");
        frm.id = "_JSON_frm_" + this._name;
        frm.style.width = frm.style.height = frm.style.borderWidth = "0";
        this._sender = frm;
        var _dm = (document.domain == location.host) ? '': 'document.domain="' + document.domain + '";',
        dout = '<html><head><meta http-equiv="Content-type" content="text/html; charset=' + this._charset + '"/></head><body><script>' + _dm + ';function ' + cfn + '(){frameElement.callback.apply(null, arguments);}<\/script><script charset="' + this._charset + '" src="' + da + '"><\/script><script>setTimeout(frameElement.errorCallback,50);<\/script></body></html>';
        frm.callback = _cb;
        frm.errorCallback = _ecb;
        this._waiting = true;
        if (QZFL.userAgent.chrome || QZFL.userAgent.opera || QZFL.userAgent.firefox < 3) {
            frm.src = "javascript:'" + encodeURIComponent(QZFL.string.escString(dout)) + "'";
            document.body.appendChild(frm);
        } else {
            document.body.appendChild(frm);
            frm.contentWindow.document.open('text/html');
            frm.contentWindow.document.write(dout);
            frm.contentWindow.document.close();
        }
    }
};
QZFL.JSONGetter.prototype.destroy = function() {
    var n = this._name;
    delete QZFL.JSONGetter.instance[n]._sender;
    QZFL.JSONGetter.instance[n]._sender = null;
    delete QZFL.JSONGetter.instance[n];
    QZFL.JSONGetter.counter--;
    return null;
};
QZFL.cookie = {
    set: function(name, value, domain, path, hour) {
        if (hour) {
            var expire = new Date();
            expire.setTime(expire.getTime() + 3600000 * hour);
        }
        document.cookie = name + "=" + value + "; " + (hour ? ("expires=" + expire.toGMTString() + "; ") : "") + (path ? ("path=" + path + "; ") : "path=/; ") + (domain ? ("domain=" + domain + ";") : ("domain=" + QZFL.config.domainPrefix + ";"));
        return true;
    },
    get: function(name) {
        var r = new RegExp("(?:^|;+|\\s+)" + name + "=([^;]*)"),
        m = document.cookie.match(r);
        return (!m ? "": m[1]);
    },
    del: function(name, domain, path) {
        document.cookie = name + "=; expires=Mon, 26 Jul 1997 05:00:00 GMT; " + (path ? ("path=" + path + "; ") : "path=/; ") + (domain ? ("domain=" + domain + ";") : ("domain=" + QZFL.config.domainPrefix + ";"));
    }
};
QZFL.Storage = {
    helperUrl: "http://imgcache.qq.com/qzone/storage/storage_helper.html",
    ifrCallback: null,
    instance: null,
    getInstance: function() {
        var _ins = this["instance"];
        if (_ins) {
            return _ins;
        }
        return null;
    }
};
QZFL.Storage.create = function(cb, opt) {
    if (typeof cb != "function") {
        return;
    }
    opt = opt || {};
    var db = null,
    dbname = opt.dbname || "qzone_database",
    defaultDomain = opt.domain || document.domain,
    helperUrl = opt.helper || QZFL.Storage.helperUrl,
    share = opt.share || false,
    _clientStore = ["globalStorage", "localStorage", "userData"];
    if (!opt.noSO) {
        _clientStore = ["so"].concat(_clientStore);
    }
    var _cs = QZFL.Storage;
    var createHelper = function(th, type) {
        var i = document.createElement("iframe");
        i.id = "userData_iframe_" + dbname;
        i.style.display = "none";
        i.src = helperUrl;
        QZFL.Storage.ifrCallback = function() {
            db = i.contentWindow.create(dbname, type);
            if (db) {
                cb(th);
            } else {
                cb(false);
            }
        };
        document.body.appendChild(i);
    };
    var _backend = {};
    _backend.userData = {
        isSupport: !!window.ActiveXObject,
        get: function(key, cb) {
            var val = db.getAttribute(key); (typeof cb == "function") && cb(val);
            return val;
        },
        set: function(key, value) {
            try {
                db.setAttribute(key, value);
                db.save(dbname);
                return true;
            } catch(ex) {
                return false;
            }
        },
        remove: function(key) {
            db.removeAttribute(key);
            db.save(dbname);
        },
        init: function() {
            if (share) {
                createHelper(this, "userData");
                return;
            }
            var el = (document.documentElement || document.body);
            el.addBehavior("#default#userdata");
            el.load(dbname);
            db = el;
            cb(this);
        },
        clear: function() {
            db.expires = new Date(1234567890000).toUTCString();
            db.save(dbname);
        }
    };
    _backend.globalStorage = {
        isSupport: !!window.globalStorage,
        get: function(key, cb) {
            var v = (v = db.getItem(key)) && v.value ? v.value: v; (typeof cb == "function") && cb(v);
            return v;
        },
        set: function(key, value) {
            try {
                db.setItem(key, value);
                return true;
            } catch(ex) {
                return false;
            }
        },
        remove: function(key) {
            db.removeItem(key);
        },
        init: function() {
            if (db = window.globalStorage[share ? defaultDomain: document.domain]) {
                cb(this);
            } else {
                cb(false);
            }
        },
        clear: function() {
            for (var k in db) {
                db.removeItem(k);
            }
        }
    };
    _backend.localStorage = {
        isSupport: !!window.localStorage,
        get: _backend.globalStorage.get,
        set: _backend.globalStorage.set,
        remove: _backend.globalStorage.remove,
        init: function() {
            if (share) {
                createHelper(this, "localStorage");
                return;
            }
            if (db = window.localStorage) {
                cb(this);
            } else {
                cb(false);
            }
        },
        clear: function() {
            var len = db.length;
            while (len--) {
                db.removeItem(db.key(len));
            }
        }
    };
    _backend.so = {
        isSupport: !!(QZFL.shareObject && QZFL.shareObject.getValidSO()),
        get: function(key, cb) {
            var val = db.get(key); (typeof cb == "function") && cb(val);
            return val;
        },
        set: function(key, value) {
            try {
                db.set(key, value);
                return true;
            } catch(ex) {
                return false;
            }
        },
        remove: function(key) {
            db.del(key);
        },
        clear: function() {
            db.clear();
        },
        init: function() {
            if (db = QZFL.shareObject.getValidSO()) {
                cb(this);
            } else {
                cb(null);
            }
        }
    }; (function() {
        for (var i = 0,
        len = _clientStore.length; i < len; i++) {
            if (_backend[_clientStore[i]].isSupport) {
                txv.log("storage:" + _clientStore[i]); (_cs["instance"] = _backend[_clientStore[i]]).init();
                return;
            }
        }
        cb(false);
    })();
}; (function(qs) {
    var isDoing = false,
    queue = [],
    opt;
    qs.setOptions = function(opts) {
        opt = opts;
    };
    qs.init = function() {
        var args = arguments;
        if (isDoing) {
            queue.push([args[0], args[1]]);
            return;
        }
        queue.push([args[0], args[1]]);
        isDoing = true;
        qs.create(function(ins) {
            var t;
            if (ins) {
                qs.get = ins.get;
                qs.set = ins.set;
                qs.remove = ins.remove;
                qs.clear = ins.clear;
                while (t = queue.pop()) {
                    ins[t[0]].apply(null, t[1]);
                }
            } else {
                if (args[0] == "get") {
                    args[1][1](null);
                }
            }
        },
        opt);
    };
    qs.get = function() {
        qs.init("get", arguments);
    };
    qs.set = function() {
        qs.init("set", arguments);
    };
    qs.remove = function() {
        qs.init("remove", arguments);
    };
    qs.clear = function() {
        qs.init("clear", arguments);
    };
})(QZFL.Storage);
QZFL.Tween = function(el, property, func, startValue, finishValue, duration) {
    this._func = func || QZFL.transitions.simple;
    this._obj = QZFL.dom.get(el);
    this.isColor = /^#/.test(startValue);
    this._prop = property;
    var reSuffix = /\d+([a-z%]+)/i.exec(startValue);
    this._suffix = reSuffix ? reSuffix[1] : "";
    this._startValue = this.isColor ? 0 : parseFloat(startValue);
    this._finishValue = this.isColor ? 100 : parseFloat(finishValue);
    if (this.isColor) {
        this._startColor = QZFL.css.convertHexColor(startValue);
        this._finishColor = QZFL.css.convertHexColor(finishValue);
    }
    this._duration = duration || 10;
    this._timeCount = 0;
    this._startTime = 0;
    this._changeValue = this._finishValue - this._startValue;
    this.currentValue = 0;
    this.isPlayed = false;
    this.isLoop = false;
    this.onMotionStart = QZFL.emptyFn;
    this.onMotionChange = QZFL.emptyFn;
    this.onMotionStop = QZFL.emptyFn;
};
QZFL.Tween.prototype.start = function(loop) {
    this._reloadTimer();
    this.isPlayed = true;
    this._runTime();
    this.isLoop = loop ? true: false;
    this.onMotionStart.apply(this);
    return "d"
};
QZFL.Tween.prototype.pause = function() {
    this.isPlayed = false;
};
QZFL.Tween.prototype.stop = function() {
    this.isPlayed = false;
    this._playTime(this._duration + 0.1);
};
QZFL.Tween.prototype._reloadTimer = function() {
    this._startTime = new Date().getTime() - this._timeCount * 1000;
};
QZFL.Tween.prototype._playTime = function(time) {
    var _isEnd = false;
    if (time > this._duration) {
        time = this._duration;
        _isEnd = true;
    }
    var pValue = this._func(time, this._startValue, this._changeValue, this._duration);
    this.currentValue = /(opacity)|(zoom)/i.test(this._prop) ? pValue: (/(transform)/i.test(this._prop) ? "scale(" + pValue + ")": Math.round(pValue));
    if (this.isColor) {
        this.currentValue = QZFL.Tween.getColor(this._startColor, this._finishColor, pValue);
    }
    var _try2setCSS = QZFL.dom.setStyle(this._obj, this._prop, this.currentValue + this._suffix);
    if (!_try2setCSS) {
        this._obj[this._prop] = this.currentValue + this._suffix;
    }
    this.onMotionChange.apply(this, [this._obj, this._prop, this.currentValue]);
    if (_isEnd) {
        this.isPlayed = false;
        if (this.isLoop) {
            this.isPlayed = true;
            this._reloadTimer();
        }
        this.onMotionStop.apply(this);
        if (window.CollectGarbage) {
            CollectGarbage();
        }
    }
};
QZFL.Tween.prototype._runTime = function() {
    var o = this;
    if (o.isPlayed) {
        o._playTime((new Date().getTime() - this._startTime) / 1000);
        setTimeout(function() {
            o._runTime.apply(o, [])
        },
        0);
    }
};
QZFL.Tween.prototype.getPercent = function() {
    return (this.currentValue - this._startValue) / this._changeValue * 100;
};
QZFL.Tween.prototype.swapValue = function() {
    if (this.isColor) {
        var tempValue = this._startColor.join(",");
        this._startColor = this._finishColor;
        this._finishColor = tempValue.split(",");
    } else {
        var tempValue = this._startValue;
        this._startValue = this._finishValue;
        this._finishValue = tempValue;
        this._changeValue = this._finishValue - this._startValue;
    }
};
QZFL.Tween.getColor = function(startColor, finishColor, percent) {
    var _sc = startColor,
    _fc = finishColor,
    _color = [];
    if (percent > 100) {
        percent = 100;
    }
    if (percent < 0) {
        percent = 0;
    }
    for (var i = 0; i < 3; i++) {
        _color[i] = Math.floor(_sc[i] * 1 + (percent / 100) * (_fc[i] - _sc[i])).toString(16);
        if (_color[i].length < 2) {
            _color[i] = "0" + _color[i];
        }
    }
    return "#" + _color.join("");
};
QZFL.transitions = {
    simple: function(time, startValue, changeValue, duration) {
        return changeValue * time / duration + startValue;
    },
    regularEaseIn: function(t, b, c, d) {
        return c * (t /= d) * t + b;
    },
    regularEaseOut: function(t, b, c, d) {
        return - c * (t /= d) * (t - 2) + b;
    },
    regularEaseInOut: function(t, b, c, d) {
        if ((t /= d / 2) < 1) {
            return c / 2 * t * t + b;
        }
        return - c / 2 * ((--t) * (t - 2) - 1) + b;
    }
};
QZFL.object.map(QZFL.lang || {});
var ua = window.ua || QZFL.userAgent,
$e = QZFL.element.get,
$ = QZFL.dom.get,
removeNode = QZFL.dom.removeElement,
addEvent = QZFL.event.addEvent,
removeEvent = QZFL.event.removeEvent,
getEvent = QZFL.event.getEvent;
QZFL.config.DCCookieDomain = "live.qq.com";
QZFL.config.domainPrefix = "live.qq.com";
QZFL.config.defaultDataCharacterSet = "utf-8";
QZFL.config.defaultShareObject = "http://live.qq.com/toolpages/getset.swf";
try {
    if (window.location.href.indexOf("http://cache.tv.qq.com") >= 0) {
        QZFL.config.FSHelperPage = "http://cache.tv.qq.com/v9/toolpages/fp_utf8.html";
    }
} catch(e) {}
if (typeof Live == "undefined" || !Live) {
    var Live;
    Live = QZFL;
    if (typeof QQLive != "undefined" && !QQLive) {
        Live.object.extend(Live, QQLive);
    }
    Live.isLoaded = false;
    Live.ver = "$Rev: 3924 $";
    Live.lastmodify = "$Date: 2010-08-18 13:36:04 +0800 (周三, 18 八月 2010) $";
};
QZFL.element.extendFn({
    val: function(value) {
        if (value == undefined) {
            return this.getVal();
        }
        this.setVal(value);
    },
    attr: function(key, value) {
        if (value == undefined) {
            return this.getAttr(key);
        }
        this.setAttr(key, value);
    },
    html: function(value) {
        if (value == undefined) {
            return this.getHtml();
        }
        this.setHtml(value);
    },
    text: function(value) {
        var attr = "innerText"
        if (!this.elements[0]) return "";
        if (typeof this.elements[0].innerText == "undefined") {
            attr = "textContent";
        }
        if (value == undefined) {
            return this.getAttr(attr);
        }
        this.setAttr(attr, value);
    },
    css: function(key, value) {
        if (value == undefined) {
            return this.getStyle(key);
        }
        this.setStyle(key, value);
    },
    toggle: function() {
        if (this.getStyle("display") != "none") {
            this.setStyle("display", "none");
            return;
        }
        this.setStyle("display", "");
    },
    focus: function() {
        if (this.elements[0]) {
            this.elements[0].focus();
        }
    },
    select: function() {
        if (this.elements[0]) {
            this.elements[0].select();
        }
    },
    size: function() {
        return this.elements.length;
    },
    removeAttr: function(name) {
        this.each(function(el) {
            el.setAttribute(name, "");
            if (el.nodeType == 1) {
                el.removeAttribute(name);
            }
        })
    },
    index: function(ele) {
        return QZFL.inArray(ele && ele._isElementHandler ? ele.elements[0] : ele, this.elements);
    },
    load: function(url, data, cachetime, callback) {
        if (QZFL.object.getType(data) == "function") {
            callback = data;
            data = null;
            cachetime = 0;
        } else if (QZFL.object.getType(cachetime) == "function") {
            callback = cachetime;
            if (QZFL.object.getType(data) == "number") {
                cachetime = data;
                data = null;
            } else if (isHashMap(data)) {
                cachetime = 0;
            }
        }
        var self = this;
        QZFL.ajaxHandle.get(url, data, cachetime,
        function(d) {
            var _data = d.replace(/<script(.|\s)*?\/script>/ig, "");
            self.setHtml(_data);
            if (QZFL.object.getType(callback) == "function") {
                callback(self, _data);
            }
        });
    }
});
QZFL.ajaxHandle = {
    ajaxSettings: {
        async: true,
        cache: true,
        data: null,
        global: true,
        url: location.href,
        type: "get",
        dataType: "text",
        timeout: 5,
        charset: "utf-8",
        jsonCache: 0,
        CSRF: false
    },
    time33: function(skey) {
        for (var i = 0,
        len = skey.length,
        hash = 5381; i < len; ++i) {
            hash += (hash << 5) + skey.charAt(i).charCodeAt();
        };
        return hash & 0x7fffffff;
    },
    getToken: function() {
        var skey = QZFL.cookie.get("skey"),
        token = !!skey ? QZFL.ajaxHandle.time33(skey) : "";
        return token;
    },
    ajax: function(setting) {
        if ( !! setting && typeof setting.type == "string" && setting.type.toUpperCase() == "POST") {
            setting.CSRF = true;
        }
        var s = {};
        QZFL.object.extend(s, this.ajaxSettings);
        QZFL.object.extend(s, setting);
        if ( !! s.CSRF) {
            s.url += (s.url.match(/\?/) ? "&": "?") + "g_tk=" + QZFL.ajaxHandle.getToken();
        }
        var _ajaxobj = null;
        var _dataType = s.dataType.toUpperCase();
        if (s.type.toUpperCase() == "POST") {
            var formSender = new QZFL.FormSender(s.url, 'POST', s.data, s.charset);
            formSender.onSuccess = function(json) {
                postSuccess(json);
            };
            formSender.onError = postError;
            beforeSend();
            formSender.send();
        } else {
            switch (_dataType) {
            case "JSON":
            case "TEXT":
            case "XML":
                {
                    if (s.jsonCache != 0) {
                        s.url += (s.url.match(/\?/) ? "&": "?") + "_=" + parseInt(new Date().valueOf() / (s.jsonCache * 1000), 10)
                    }
                    _ajaxobj = new QZFL.XHR(s.url, s.cname, s.type, s.data, s.async, !s.cache);
                    _ajaxobj.charset = s.charset;
                    _ajaxobj.onSuccess = success;
                    _ajaxobj.onError = error;
                    beforeSend();
                    _ajaxobj.send();
                    break;
                }
            case "JSONP":
                {
                    s.async = true;
                    var jsonp, jsre = /=\?(&|$)/g;
                    sType = s.type.toUpperCase();
                    if (!s.url.match(jsre) && !s.jsonpFunName) s.url += (s.url.match(/\?/) ? "&": "?") + (s.jsonp || "callback") + "=?";
                    var _timespan = s.jsonCache == 0 ? new Date().valueOf() : parseInt(new Date().valueOf() / (s.jsonCache * 1000), 10);
                    if ( !! s.jsonpFunName) {
                        jsonp = s.jsonpFunName;
                    } else {
                        jsonp = s.jsonpFunName || "jsonp" + _timespan;
                        s.url = s.url.replace(jsre, "=" + jsonp + "$1");
                    }
                    if (s.jsonCache != 0) {
                        s.url += (s.url.match(/\?/) ? "&": "?") + "_=" + _timespan;
                    }
                    _ajaxobj = new QZFL.JSONGetter(s.url, s.cname, s.data, s.charset, s.junctionMode);
                    _ajaxobj.onSuccess = jsonpSuccess;
                    _ajaxobj.onError = error;
                    _ajaxobj.onTimeout = timeout;
                    beforeSend();
                    _ajaxobj.send(jsonp);
                    break;
                }
            case "SCRIPT":
                {
                    if (s.jsonCache != 0) {
                        s.url += (s.url.match(/\?/) ? "&": "?") + "_=" + parseInt(new Date().valueOf() / (s.jsonCache * 1000), 10)
                    }
                    var jsloader = new QZFL.JsLoader();
                    jsloader.onload = function() {
                        scriptSuccess();
                    };
                    jsloader.onerror = function() {
                        scriptError();
                    }
                    beforeSend();
                    jsloader.load(s.url, document, s.charset);
                    break;
                }
            }
        }
        function beforeSend() {
            if (s.beforeSend) {
                s.beforeSend(s);
            }
        }
        function success(data) {
            if (s.success) {
                if (_dataType == "JSON") {
                    jsonsuccess(data["text"]);
                } else {
                    var _dataprop = _dataType == "TEXT" ? "text": "xmlDom";
                    s.success(data[_dataprop]);
                }
            }
            complete();
        }
        function jsonpSuccess(data) {
            if (s.success) {
                s.success(data);
            }
            complete();
        }
        function postSuccess(json) {
            if (s.success) {
                s.success(json);
            }
            postComplete();
        }
        function postError() {
            if (typeof s.error == "function") {
                s.error();
            }
            postComplete();
        }
        function postComplete() {
            if (typeof s.complete == "function") {
                s.complete();
            }
        }
        function scriptSuccess() {
            if (typeof s.success == "function") {
                s.success();
            }
            scriptComplete();
        }
        function scriptError() {
            if (typeof s.error == "function") {
                s.error();
            }
            scriptComplete();
        }
        function scriptComplete() {
            if (typeof s.complete == "function") {
                s.complete();
            }
        }
        function jsonsuccess(text) {
            if (s.success) {
                try {
                    if (typeof JSON == "object" && typeof JSON.parse == "function") {
                        var jsonObj = JSON.parse(text);
                        s.success(jsonObj);
                        jsonObj = null;
                        return;
                    };
                    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
                    escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
                    cx.lastIndex = 0;
                    if (cx.test(text)) {
                        text = text.replace(cx,
                        function(a) {
                            return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice( - 4);
                        });
                    }
                    if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, '').replace(/new Date\(\]\)/g, "]"))) {
                        eval("var __json=" + text + ";");
                        s.success(__json);
                        __json = null;
                        return;
                    }
                } catch(ex) {
                    if (s.error) {
                        s.error();
                    }
                }
            }
        }
        function error(errRet) {
            if (s.error) {
                s.error(errRet || "", QZFL.XHR.instance[_ajaxobj._name]);
            }
            complete();
        }
        function timeout() {
            if (typeof s.timeout == "function") {
                s.timeout(QZFL.XHR.instance[_ajaxobj._name]);
            }
            complete();
        }
        function complete() {
            if (s.complete) {
                if ( !! _ajaxobj && !!_ajaxobj._name) s.complete(QZFL.XHR.instance[_ajaxobj._name], s);
                else s.complete(null, s);
            }
            if (s.async && !!_ajaxobj && (_dataType == "TEXT" || _dataType == "XML")) {
                try {
                    _ajaxobj = _ajaxobj.destroy();
                } catch(exception) {}
            }
        }
    },
    get: function(url, data, cachetime, callback, dataType) {
        if (QZFL.object.getType(data) == "function") {
            callback = data;
            data = null;
            cachetime = 0;
        } else if (QZFL.object.getType(cachetime) == "function") {
            callback = cachetime;
            if (QZFL.object.getType(data) == "number") {
                cachetime = data;
                data = null;
            } else if (isHashMap(data)) {
                cachetime = 0;
            }
        }
        dataType = dataType || "text";
        this.ajax({
            url: url,
            data: data,
            dataType: dataType,
            type: "get",
            jsonCache: cachetime,
            success: callback
        });
    },
    getScript: function(url, callback) {
        this.ajax({
            url: url,
            success: callback,
            dataType: "script"
        });
    },
    getJsonp: function(url, data, cachetime, callback) {
        this.get(url, data, cachetime, callback, "jsonp");
    },
    getJson: function(url, data, cachetime, callback) {
        this.get(url, data, cachetime, callback, "json");
    },
    ajaxQueue: function(queConf) {
        var urlInfo = queConf.urls;
        var success = queConf.success || QZFL.emptyFn;
        var error = queConf.error || QZFL.emptyFn;
        var complete = queConf.complete || QZFL.emptyFn;
        var beforeSend = queConf.beforeSend || QZFL.emptyFn;
        urlInfo = QZFL.object.getType(urlInfo) == "array" ? urlInfo: [urlInfo];
        var isErr = false;
        jsonInfo = {};
        function finish(key, json) {
            jsonInfo[key] = json;
            urlInfo.shift();
            if ( !! urlInfo.length) {
                return;
            }
            if ( !! isErr) return;
            success(jsonInfo);
        }
        function failed(key) {
            isErr = true;
            urlInfo.shift();
            if (typeof error == "function") {
                error(key);
            }
        }
        function allEnd() {
            if ( !! urlInfo.length) {
                return;
            }
            complete();
        }
        var uLen = urlInfo.length;
        beforeSend();
        for (var i = 0; i < uLen; i++) {
            new
            function() {
                var idx = i;
                var name = urlInfo[idx].name;
                $j.ajax({
                    "url": urlInfo[idx].url,
                    "dataType": urlInfo[idx].dataType,
                    "type": "get",
                    "data": urlInfo[idx].data,
                    "success": function(json) {
                        finish(name, json);
                    },
                    "error": function() {
                        failed(name);
                    },
                    "complete": function() {}
                })
            }
        }
    }
}
window.$j = QZFL.ajaxHandle;
QZFL.element.extendFn({
    delegate: (function() {
        var eventHandle = function(evt) {
            var target = QZFL.event.getTarget(evt);
            var handleArr = this.handleList[evt.type];
            if ( !! handleArr) {
                for (var idx = 0,
                len = handleArr.length; idx < len; idx++) {
                    if (handleArr[idx]) {
                        if (typeof handleArr[idx].selector == "object" && quickIs(target, handleArr[idx].selector)) {
                            handleArr[idx].handler.apply(target, arguments);
                        } else if (typeof handleArr[idx].selector == "string" && QZFL.inArray(target, $e(handleArr[idx].selector).elements) != -1) {
                            handleArr[idx].handler.apply(target, arguments);
                        }
                    }
                }
            }
        },
        quickParse = function(selector) {
            var reg = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?(?:\[([\w=]+)\])?$/;
            var quick = reg.exec(selector);
            if (quick) {
                quick[1] = (quick[1] || "").toLowerCase();
                quick[3] = quick[3] && new RegExp("(?:^|\\s)" + quick[3] + "(?:\\s|$)");
            }
            return quick || selector;
        },
        quickIs = function(elem, m) {
            if (!QZFL.lang.isArray(m)) {
                return false;
            }
            var attrs = elem.attributes || {};
            var r = true;
            if ( !! m[4]) {
                r = false;
                var arr = m[4].split("=");
                if (arr.length == 1) {
                    r = !!attrs[arr[0]];
                } else if (arr.length == 2) {
                    r = (arr[1] == elem.getAttribute(arr[0]));
                }
            }
            return ((!m[1] || elem.nodeName.toLowerCase() === m[1]) && (!m[2] || (attrs.id || {}).value === m[2]) && (!m[3] || m[3].test((attrs["class"] || {}).value)) && r);
        };
        return function(selector, type, fn, argArr) {
            var elem = this.elements[0];
            if (typeof selector != "string" || selector.length == 0 || typeof fn != "function") {
                return this;
            } else if (!elem || elem.nodeType == 3 || elem.nodeType == 8) {
                return this;
            }
            var handleList = elem.handleList;
            var handleObj = {
                handler: fn,
                selector: quickParse(selector)
            };
            if (!handleList) {
                handleList = elem.handleList = {};
            }
            if (!handleList[type]) {
                handleList[type] = [handleObj];
                QZFL.event.addEvent(elem, type, eventHandle, argArr);
            } else {
                handleList[type].push(handleObj);
            }
            return this;
        }
    })(),
    undelegate: function(selector, type) {
        var elem = this.elements[0];
        if (typeof selector == "string" && typeof type == "string" && !!elem && !!elem.handleList && !!elem.handleList[type]) {
            var idx = 0;
            var handleList = elem.handleList[type];
            var len = handleList.length;
            for (; idx < len; idx++) {
                if ( !! handleList[idx] && (handleList[idx].selector[0] === selector || handleList[idx].selector === selector)) {
                    delete handleList[idx];
                }
            }
        }
        return this;
    }
});
Live.lazyLoad = (function() {
    var map_el = {};
    var el_obj = [];
    var download_count = 0;
    var last_offset = -1;
    var doc_el;
    var lazy_load_tag;
    var map_func = {};
    var tmp_count = 0;
    var is_finish = true;
    function initVar(tags, scrollElm) {
        if (scrollElm) {
            doc_el = scrollElm;
        } else {
            doc_el = document.compatMode == 'BackCompat' ? document.body: document.documentElement;
        }
        lazy_load_tag = tags || ["img", "iframe"];
    };
    function initElementMap() {
        var all_el = [];
        for (var i = 0,
        len = lazy_load_tag.length; i < len; i++) {
            var el = $e(lazy_load_tag[i] + "[lz_src]").elements;
            for (var j = 0,
            len2 = el.length; j < len2; j++) {
                all_el.push(el[j]);
            }
        }
        for (var key = 0,
        len = all_el.length; key < len; key++) {
            if (typeof(all_el[key]) == "object" && all_el[key].getAttribute("lz_src")) {
                el_obj.push(all_el[key]);
            } else {}
        }
        for (var i = 0,
        len = el_obj.length; i < len; i++) {
            var o_img = el_obj[i];
            o_img.style.visibility = "hidden";
            var t_index = Math.round(QZFL.dom.getXY(o_img)[1]);
            if (map_el[t_index]) {
                map_el[t_index].push(i);
            } else {
                var t_array = [];
                t_array[0] = i;
                map_el[t_index] = t_array;
                download_count++;
            }
        }
    };
    function getScreenShowHeight() {
        var scrollTop = window.pageYOffset || doc_el.scrollTop;
        return doc_el.clientHeight + scrollTop;
    };
    function doLoading() {
        tmp_count++;
        if (!download_count) {
            is_finish = true;
            return;
        }
        var img_show_height = getScreenShowHeight();
        if (last_offset >= img_show_height) {
            setTimeout(doLoading, 200);
            return;
        }
        last_offset = img_show_height;
        for (var key in map_el) {
            if (img_show_height > key) {
                var t_o = map_el[key];
                var img_vl = t_o.length;
                for (var l = 0; l < img_vl; l++) {
                    el_obj[t_o[l]].src = el_obj[t_o[l]].getAttribute("lz_src");
                    el_obj[t_o[l]].style.visibility = "visible";
                }
                delete map_el[key];
                download_count--;
            } else {}
        }
        for (var key in map_func) {
            if (img_show_height > key) {
                var t_o = map_func[key];
                var img_vl = t_o.length;
                for (var l = 0; l < img_vl; l++) {
                    t_o[l]();
                }
                delete map_func[key];
                download_count--;
            }
        }
        setTimeout(doLoading, 200);
    };
    function appleShowImg() {
        for (var i = 0,
        len = el_obj.length; i < len; i++) {
            el_obj[i].src = el_obj[i].getAttribute("lz_src");
            el_obj[i].style.visibility = "visible";
        }
        delete el_obj;
        delete map_el;
        download_count = 0;
    }
    function init(tags, scrollElm) {
        initVar(tags, scrollElm);
        initElementMap();
        is_finish = false;
        setTimeout(function() {
            doLoading();
        },
        0);
    };
    function lazyFunc(element, callback, fix) {
        fix = fix || 0;
        if (!element.getXY) {
            element = $e(element);
        }
        var t_index = element.getXY()[1] + fix;
        if (map_func[t_index]) {
            map_func[t_index].push(callback);
        } else {
            var t_array = [];
            t_array[0] = callback;
            map_func[t_index] = t_array;
            download_count++;
        }
        if (is_finish) {
            is_finish = false;
            doLoading();
        }
    };
    function resetLastOffset(offset) {
        last_offset = offset;
    };
    function reset() {
        map_el = {};
        el_obj = [];
        download_count = 0;
        last_offset = -1;
        lazy_load_tag;
        map_func = {};
        tmp_count = 0;
        is_finish = true;
    }
    return {
        init: init,
        lazyFunc: lazyFunc,
        getScreenShowHeight: getScreenShowHeight,
        reset: reset,
        resetLastOffset: resetLastOffset
    }
})();
var _irt = {
    version: '0.0.7',
    dataHandler: 'http://tj.video.qq.com/fcgi-bin/set_cookie?otype=json&',
    dataHandler_video: 'http://tj.video.qq.com/fcgi-bin/set_cookie?otype=json&',
    _account: '',
    _u_eventid: '',
    _debug: false,
    init: function(_identity) {
        var irt = this;
        this._account = _identity;
        this._track();
    },
    _trackStart: function(_identify) {
        if (_identify.indexOf("-") < 0) return 'invalid user identify.';
        this.init(_identify);
        return this;
    },
    _track: function() {
        this._feedBack();
    },
    record_video_api: function(video_id, duration, video_category_label, tag) {
        if (tag + "" == "0") {
            this._u_eventid = Math.abs(parseInt((navigator.userAgent ^ new Date().getTime()) * Math.random())) + video_id;
            this._feedBack_video(video_id, duration, video_category_label, tag);
            return;
        }
        this._feedBack_video(video_id, duration, video_category_label, tag);
    },
    _feedBack: function() {
        var _m = Array("id=" + this._account, "pt=" + encodeURIComponent(document.title), "dm=" + encodeURIComponent(window.location.host), "pa=" + encodeURIComponent(window.location.pathname), "sr=" + document.body.clientWidth + 'x' + document.body.clientHeight, "ul=" + (navigator.language || "zh-CN"), "tv=" + this.version, "r=" + new Date().getTime(), "url=" + encodeURIComponent(window.location.href), "ua=" + encodeURIComponent(navigator.userAgent.toString())).join('&');
        var _imgURL = this.dataHandler + _m;
        this._img = new Image();
        this._img.src = _imgURL;
    },
    _feedBack_video: function(video_id, duration, video_category_label, tag) {
        var _m = Array("ta=" + tag, "eid=" + this._u_eventid, "pt=" + encodeURIComponent(document.title), "vid=" + video_id, "du=" + duration, "la=" + encodeURIComponent(video_category_label), "r=" + new Date().getTime()).join('&');
        var _imgURL = this.dataHandler_video + _m;
        this._img = new Image();
        this._img.src = _imgURL;
    }
};
Live.mypv = {
    report: function() {
        var url = document.location.toString().toLowerCase();
        var ptag = txv.common.getUrlParam("ptag", url) if (ptag == "") {
            ptag = txv.common.getUrlParam("adtag", url);
        }
        if (ptag == "") {
            ptag = txv.common.getUrlParam("pgv_ref", url);
        }
        if (ptag == "") {
            ptag = QZFL.cookie.get("ptag");
            if (ptag == "") {
                var dm = this.getDomainOfURL(document.referrer);
                if ("" != dm && "v.qq.com" != dm) {
                    ptag = dm.replace(/\./g, "_");
                    QZFL.cookie.set("ptag", ptag, "v.qq.com");
                }
            }
        } else {
            QZFL.cookie.set("ptag", ptag, "v.qq.com");
        }
        window.imgpvr = new Image();
        window.imgpvr.src = ['http://rcgi.video.qq.com/pv_report?', "refer=", encodeURIComponent(document.referrer), "&ptag=", ptag, "&t=", new Date().valueOf()].join("");
    },
    getDomainOfURL: function(url) {
        var dm = "";
        if (typeof url == "undefined" || null == url || "" == url) {
            return dm;
        }
        var regex = /.*\:\/\/([^\/]*).*/;
        var match = url.match(regex);
        if (typeof match != "undefined" && null != match) {
            dm = match[1];
        }
        return dm;
    }
};
Live.tj2 = {
    jspath: "http://pingjs.qq.com/ping.js",
    comscorePath: "http://b.scorecardresearch.com/beacon.js",
    comscoreParam: {
        "c1": 2,
        "c2": 6036207
    },
    keyPrefix: "ISD.LIVEWEB.",
    initPGVGlobalParam: function() {
        pgvVirtualDomain = "";
        pvCurDomain = "";
        pvCurUrl = "";
    },
    isLoadingJs: false,
    hot: function(key) {
        function doSend() {
            Live.tj2.initPGVGlobalParam();
            pgvSendClick({
                hottag: Live.tj2.keyPrefix + key
            });
        };
        if (typeof(pgvSendClick) == 'function') {
            doSend();
        } else {
            $j.getScript(Live.tj2.jspath, doSend);
        }
    },
    button: function(key, virtualPage, virtualDomain) {
        function doSend() {
            if (typeof virtualPage == "undefined") {
                var pagename = key;
                var arrKey = key.split(".");
                if (arrKey.length > 0) {
                    pagename = arrKey[0];
                }
                pagename += ".html";
                virtualPage = "/virtualpage/" + pagename;
            }
            Live.tj2.initPGVGlobalParam();
            if (typeof virtualDomain != "undefined") {
                pgvSendClick({
                    hottag: Live.tj2.keyPrefix + key,
                    virtualURL: virtualPage,
                    virtualDomain: virtualDomain
                });
            } else {
                pgvSendClick({
                    hottag: Live.tj2.keyPrefix + key,
                    virtualURL: virtualPage
                });
            }
        };
        if (typeof(pgvSendClick) == 'function') {
            doSend();
        } else {
            $j.getScript(Live.tj2.jspath, doSend);
        }
    },
    senseParam: null,
    pv: function(extData) {
        var pvHostFilter = {};
        pvHostFilter["v.qq.com"] = true;
        if (pvHostFilter[location.host]) {
            if (typeof Live.mypv != "undefined") {
                Live.mypv.report();
            }
        }
        function doSend() {
            Live.tj2.initPGVGlobalParam();
            if (typeof pgvVirtualURL != "undefined") {
                pgvVirtualURL = "";
            }
            Live.tj2.isLoadingJs = false;
            if (typeof pvRepeatCount != "undefined") {
                pvRepeatCount = 1;
            }
            if (!extData && !Live.tj2.senseParam) {
                pgvMain();
            } else {
                var _extd = {};
                if ( !! Live.tj2.senseParam) Live.object.extend(_extd, {
                    "senseParam": Live.tj2.senseParam
                });
                if ( !! extData) {
                    Live.object.extend(_extd, extData);
                    if ( !! extData.virtualURL) {
                        pvCurUrl = extData.virtualURL;
                    }
                }
                pgvMain("", _extd);
            }
            var hostFilter = {};
            hostFilter["v.qq.com"] = true;
            hostFilter["boke.qq.com"] = true;
            hostFilter["cache.tv.qq.com"] = true;
            hostFilter["play.v.qq.com"] = true;
            hostFilter["imgcache.qq.com"] = true;
            hostFilter["sns.video.qq.com"] = true;
            if (hostFilter[location.host]) {
                Live.tj2.pv_irt();
                Live.tj2.pv_comscore();
            }
        };
        if (typeof(pgvMain) == "function") {
            doSend();
        } else {
            if (Live.tj2.isLoadingJs == false) {
                Live.tj2.isLoadingJs = true;
                $j.getScript(Live.tj2.jspath, doSend);
            } else {
                setTimeout(function() {
                    Live.tj2.pv(extData)
                },
                200);
            }
        }
    },
    pv_irt: function() {
        if (typeof(_irt) != "undefined") {
            _irt.init("");
        }
    },
    pv_comscore: function() {
        $j.getScript(Live.tj2.comscorePath,
        function() {
            if (typeof(Live.tj2.comscoreParam.c10) == "undefined") {
                Live.tj2.comscoreParam.c10 = Live.cookie.get("pvid");
            }
            try {
                COMSCORE.beacon(Live.tj2.comscoreParam);
            } catch(err) {
                Live.tj2.button("comscore.error");
            }
        });
    },
    watch: function() {
        $e("body").bind("click",
        function() {
            if (typeof(pgvWatchClick) == 'function') {
                Live.tj2.initPGVGlobalParam();
                pgvWatchClick();
            }
        });
    },
    performance: function(flag1, flag2, flag3) {
        var timing = window.performance || window.msPerformance || window.webkitPerformance;
        if (!timing) {
            return;
        }
        timing = timing.timing;
        var times = [];
        var d00 = timing.domainLookupStart;
        times[0] = timing.domainLookupEnd;
        times[1] = timing.requestStart;
        times[2] = timing.responseStart;
        times[3] = timing.responseEnd;
        times[4] = timing.domComplete;
        times[5] = timing.loadEventEnd;
        var s = [["http://isdspeed.qq.com/cgi-bin/r.cgi?flag1=", flag1, "&flag2=", flag2, "&flag3=", flag3].join('')];
        for (var i = 0,
        len = times.length; i < len; i++) {
            if ( !! times[i]) s.push((i + 1) + "=" + (times[i] - d00));
        }
        window._speed_img = new Image();
        window._speed_img.src = s.join("&");
    }
};
Live.pgv = Live.tj2;
Live.virtualpgv = {
    virtualHost: "pgv.live.qq.com",
    virtualPath: "/liveweb/",
    pv: function(url) {
        Live.tj2.initPGVGlobalParam();
        Live.tj2.pv({
            virtualDomain: Live.virtualpgv.virtualHost,
            virtualURL: [Live.virtualpgv.virtualPath, url].join("")
        });
    }
};
Live.Pager = function() {
    this.eleContainer = null;
    this.alwayShow = false;
    this.totalPage = 0;
    this.pageSize = Live.Pager.Const.PG_DEF_PAGESIZE;
    this.previousPage = 0;
    this.currentPage = 0;
    this.offsetPage = Live.Pager.Const.PG_DEF_OFFSETSIZE;
    this.staus = Live.Pager.Const.PG_STATUS_READY;
    this.initialized = false;
    this.onTurnPage = function(page, pagesize) {
        return true;
    };
    this.totalCnt = 0;
    this.id = Live.Pager.maxId;
    this.hideEmpty = true;
    this.Templet = {
        CONTENT: '<form method="get" action="##" id="pager_form_{id}">{begin}<p class="mod_pagenav_main">{previous}<span class="mod_pagenav_count">{first}{prevdot}{pager}{nextdot}{last}</span>{pagecount}{summary}{next}</p><p class="mod_pagenav_option"><span class="mod_pagenav_turn">{goinput}{gobutton}</span></p></form>',
        FIRST_DISABLE: '',
        FIRST_ENABLE: '<a href="##" title="1" id="pager_first_{id}"><span>1</span></a>\n',
        LAST_DISABLE: '',
        LAST_ENABLE: '<a href="##" title="{totpage}" id="pager_last_{id}"><span>{totpage}</span></a>\n',
        PREVIOUS_DISABLE: '<span class="mod_pagenav_disable"><span>上一页</span></span>\n',
        PREVIOUS_ENABLE: '<a href="##" id="pager_previous_{id}" title="上一页"><span>上一页</span></a>\n',
        NEXT_DISABLE: '<span class="mod_pagenav_disable"><span>下一页</span></span>\n',
        NEXT_ENABLE: '<a href="##" title="下一页" id="pager_next_{id}"><span>下一页</span></a>\n',
        PAGE_NORMAL: '<a href="##" id="pager_num_{id}_{pagenum}" title="{pagenum}"><span>{pagenum}</span></a>\n',
        PAGE_CURRENT: '<span class="current"><span>{pagenum}</span></span>\n',
        GO_PAGE_INPUT: '<span class="mod_pagenav_turn">转到<input type="text" id="pager_input_{id}" name="PageCount" autocomplete="off"/>页\n',
        GO_PAGE_BUTTON: '<button type="submit" id="pager_btn_{id}"><span>确定</span></button>\n',
        PAGE_COUNT: '<span class="mod_pagenav_count2"><span class="current">{curpg}</span>/{totpage}</span>\n',
        PREVDOT_ENABLE: '<span class="mod_pagenav_more"><span>…</span></span>\n',
        PREVDOT_DISABLE: "",
        NEXTDOT_ENABLE: '<span class="mod_pagenav_more"><span>…</span></span>\n',
        NEXTDOT_DISABLE: "",
        SUMMARY: "",
        BEGIN: ""
    };
    Live.Pager.items[Live.Pager.maxId] = this;
    Live.Pager.maxId++;
}
Live.Pager.Const = {
    PG_STATUS_READY: 0,
    PG_STATUS_GO: 1,
    PG_DEF_OFFSETSIZE: 2,
    PG_DEF_PAGESIZE: 20
}
Live.Pager.maxId = 0;
Live.Pager.items = {};
Live.Pager.prototype.init = function(eleContainer, totalPage) {
    if (!eleContainer || !totalPage) return;
    this.eleContainer = eleContainer;
    this.totalPage = totalPage;
    this.initialized = true;
}
Live.Pager.prototype.fillPager = function() {
    if (!this.initialized || !this.currentPage || !this.eleContainer) return;
    var pageArr = [];
    var pageHTML = '';
    var start, end, i;
    var aBtn, aForm;
    this.currentPage = parseInt(this.currentPage, 10);
    this.offsetPage = parseInt(this.offsetPage);
    start = (this.currentPage - this.offsetPage > 0) ? (this.currentPage - this.offsetPage) : 1;
    end = (this.currentPage + this.offsetPage <= this.totalPage) ? (this.currentPage + this.offsetPage) : this.totalPage;
    var leftoffset, rightoffset;
    leftoffset = this.currentPage - start;
    leftoffset = leftoffset > 0 ? leftoffset: 0;
    rightoffset = end - this.currentPage;
    rightoffset = rightoffset > 0 ? rightoffset: 0;
    if (leftoffset + rightoffset < this.offsetPage * 2) {
        m = Math.abs(leftoffset - rightoffset);
        if (leftoffset < rightoffset) {
            end = end + m;
        } else {
            start = start - m;
        }
    }
    if (end > this.totalPage) end = this.totalPage;
    if (start < 1) start = 1;
    if (start - 1 >= 2 && this.currentPage - start >= 2) {
        start++;
    }
    if (end + 2 == this.totalPage) {
        end++;
    }
    for (i = start; i <= end && i <= this.totalPage; i++) {
        if (i == 1 && this.currentPage != 1) continue;
        if (i == this.totalPage && this.currentPage != this.totalPage) continue;
        if (i == this.currentPage) {
            pageArr.push(this.Templet.PAGE_CURRENT.replace(/\{pagenum\}/g, i));
        } else {
            pageArr.push(this.Templet.PAGE_NORMAL.replace(/\{pagenum\}/g, i));
        }
    }
    pageHTML = this.Templet.CONTENT.replace(/\{pager\}/g, pageArr.join(''));
    pageHTML = pageHTML.replace(/\{prevdot\}/g, start - 1 > 1 ? this.Templet.PREVDOT_ENABLE: this.Templet.PREVDOT_DISABLE);
    pageHTML = pageHTML.replace(/\{nextdot\}/g, this.totalPage - end > 1 ? this.Templet.NEXTDOT_ENABLE: this.Templet.NEXTDOT_DISABLE);
    pageHTML = pageHTML.replace(/\{first\}/g, (this.currentPage == 1) ? this.Templet.FIRST_DISABLE: this.Templet.FIRST_ENABLE);
    pageHTML = pageHTML.replace(/\{previous\}/g, (this.currentPage == 1) ? this.Templet.PREVIOUS_DISABLE: this.Templet.PREVIOUS_ENABLE);
    pageHTML = pageHTML.replace(/\{next\}/g, (this.currentPage == this.totalPage) ? this.Templet.NEXT_DISABLE: this.Templet.NEXT_ENABLE);
    pageHTML = pageHTML.replace(/\{last\}/g, (this.currentPage == this.totalPage) ? this.Templet.LAST_DISABLE: this.Templet.LAST_ENABLE);
    pageHTML = pageHTML.replace(/\{goinput\}/g, this.Templet.GO_PAGE_INPUT);
    pageHTML = pageHTML.replace(/\{gobutton\}/g, this.Templet.GO_PAGE_BUTTON);
    pageHTML = pageHTML.replace(/\{summary\}/g, this.Templet.SUMMARY);
    pageHTML = pageHTML.replace(/\{pagecount\}/g, this.Templet.PAGE_COUNT);
    pageHTML = pageHTML.replace(/\{id\}/g, this.id);
    pageHTML = pageHTML.replace(/\{begin\}/g, this.Templet.BEGIN);
    pageHTML = pageHTML.replace(/\{totpage\}/g, this.totalPage);
    pageHTML = pageHTML.replace(/\{curpg\}/g, this.currentPage);
    pageHTML = pageHTML.replace(/\{pagenum\}/g, this.currentPage);
    pageHTML = pageHTML.replace(/\{totalcnt\}/g, this.totalCnt);
    if (this.totalPage <= 1 && this.alwayShow == false) {
        this.eleContainer.style.display = (this.hideEmpty ? 'none': '');
    } else {
        this.eleContainer.style.display = '';
    }
    this.eleContainer.innerHTML = pageHTML;
    for (i = start; i <= end; i++) {
        if (aBtn = $('pager_num_' + this.id + '_' + i)) {
            QZONE.event.addEvent(aBtn, 'click', QZONE.event.bind(this, 'goPage', i));
        }
    }
    var self = this;
    if (aBtn = $('pager_first_' + this.id)) QZONE.event.addEvent(aBtn, 'click', QZONE.event.bind(this, 'goPage', 1, this.pageSize));
    if (aBtn = $('pager_previous_' + this.id)) QZONE.event.addEvent(aBtn, 'click', QZONE.event.bind(this, 'goPage', this.currentPage - 1, this.pageSize));
    if (aBtn = $('pager_next_' + this.id)) QZONE.event.addEvent(aBtn, 'click', QZONE.event.bind(this, 'goPage', this.currentPage + 1, this.pageSize));
    if (aBtn = $('pager_last_' + this.id)) QZONE.event.addEvent(aBtn, 'click', QZONE.event.bind(this, 'goPage', this.totalPage, this.pageSize));
    if (aForm = $('pager_form_' + this.id)) {
        aForm.onsubmit = function() {
            if (self.checkPage()) {
                var $ele = $e('#pager_input_' + self.id);
                var ijumppage = QZFL.string.trim($ele.getVal());
                self.goPage(ijumppage);
                return false;
            }
            return false;
        };
    }
};
Live.Pager.prototype.goPage = function(page) {
    page = parseInt(page, 10);
    if (isNaN(page)) page = 1;
    if (page < 1) {
        page = 1;
    } else if (page > this.totalPage) {
        page = this.totalPage;
    }
    this.previousPage = this.currentPage;
    this.currentPage = page;
    if (typeof this.onTurnPage == 'function') {
        if (!this.onTurnPage(this.currentPage, this.pageSize)) {
            return false;
        }
    }
    this.fillPager();
    Live.event.preventDefault();
    return false;
}
Live.Pager.prototype.checkPage = function() {
    var $ele = $e('#pager_input_' + this.id);
    var ijumppage = QZFL.string.trim($ele.getVal());
    if (ijumppage.length == 0) {
        this.showError("您未输入页码，请输入数字页码！");
        $ele.focus();
        $ele.elements[0].select();
        return false;
    }
    if (/^\d+$/.test(ijumppage) == false) {
        this.showError("您输入的页码不正确，请重新输入数字页码！");
        $ele.elements[0].focus();
        $ele.elements[0].select();
        return false;
    }
    ijumppage = parseInt(ijumppage, 10);
    if (ijumppage <= 0 || ijumppage > this.totalPage) {
        this.showError("您输入的页码不存在，请重新输入数字页码！");
        $ele.elements[0].focus();
        $ele.elements[0].select();
        return false;
    }
    return true;
}
Live.Pager.prototype.showError = function(msg) {
    alert(msg);
}
Live.Pager.prototype.refresh = function() {
    this.goPage(this.currentPage);
}
Live.TabShow = function() {
    this.config = {
        tabItems: null,
        contentItems: null,
        getType: "ajax",
        ajaxAttr: "rel",
        tabShowCss: "current",
        mouseEvt: "mouseover",
        mouseDelay: 300,
        enableClick: true,
        callback: null,
        jsonInterval: 0,
        jsonpFun: null,
        isReturnFalse: true,
        showCss: null,
        hideCss: null,
        afterShowContent: null,
        defaultIndex: 0,
        foceLoad: false
    }
    _timer = [];
};
Live.TabShow.prototype = {
    init: function(_config) {
        for (var prop in _config) {
            this.config[prop] = _config[prop];
        }
        var self = this;
        if (this.config.mouseEvt == "mouseover") {
            this.config.tabItems.each(function(el, i) {
                var $el = $e(el);
                $el.attr("hideFocus", "true");
                $el.bind("mouseover",
                function() {
                    _timer[0] = setTimeout(function() {
                        self.change(i);
                    },
                    self.config.mouseDelay);
                });
                $el.bind("mouseout",
                function() {
                    if (_timer && _timer[0] != -1) {
                        clearTimeout(_timer[0]);
                        _timer[0] = -1;
                    }
                });
                if (self.config.enableClick) {
                    $e(el).bind("click",
                    function() {
                        self.change(i);
                        if (self.config.isReturnFalse == true) return false;
                    });
                }
            });
        } else {
            this.config.tabItems.each(function(el, i) {
                $e(el).bind(self.config.mouseEvt,
                function() {
                    self.change(i);
                });
            });
        }
        if (this.config.defaultIndex >= 0) {
            this.change(this.config.defaultIndex);
        }
    },
    change: function(index) {
        var contentItemsCnt = this.config.contentItems.size();
        if (contentItemsCnt != 1 && (index < 0 || index > contentItemsCnt - 1)) return;
        var $content = contentItemsCnt == this.config.tabItems.size() ? this.config.contentItems.get(index) : this.config.contentItems.get(0);
        var $tab = this.config.tabItems.get(index);
        var self = this;
        if (this.config.getType == "ajax" || this.config.getType == "html" || this.config.getType == "json" || this.config.getType == "jsonp" || this.config.getType == "script") {
            if ( !! this.config.foceLoad || contentItemsCnt != this.config.tabItems.size() || Live.string.trim($content.html()).length == 0) {
                if (this.config.getType == "ajax" || this.config.getType == "html") {
                    $content.load(this.config.tabItems.get(index).attr(this.config.ajaxAttr),
                    function() {
                        self.config.callback($content, {},
                        $tab);
                        self.showContent(index);
                        self.afterShowContentHandle($tab, $content, index);
                        return;
                    });
                } else if (this.config.getType == "json") {
                    $j.getJson(this.config.tabItems.get(index).attr(this.config.ajaxAttr), this.config.jsonInterval,
                    function(json) {
                        if (typeof self.config.callback == "function") {
                            self.config.callback($content, json, $tab);
                            self.showContent(index);
                            self.afterShowContentHandle($tab, $content, index);
                        }
                    });
                } else if (this.config.getType == "jsonp") {
                    $j.ajax({
                        dataType: "jsonp",
                        url: self.config.tabItems.get(index).attr(this.config.ajaxAttr),

                        jsonpFunName: self.config.jsonpFun,
                        jsonCache: self.config.jsonInterval,
                        success: function(json) {
                            self.config.callback($content, json, $tab);
                            self.showContent(index);
                            self.afterShowContentHandle($tab, $content, index);
                        }
                    });
                } else if (this.config.getType == "script") {
                    $j.ajax({
                        dataType: "script",
                        url: self.config.tabItems.get(index).attr(this.config.ajaxAttr),
                        jsonCache: self.config.jsonInterval,
                        success: function(json) {
                            self.config.callback($content, {},
                            $tab);
                            self.showContent(index);
                            self.afterShowContentHandle($tab, $content, index);
                        }
                    });
                }
            } else {
                self.showContent(index);
                self.afterShowContentHandle($tab, $content, index);
            }
        } else {
            self.showContent(index);
            self.afterShowContentHandle($tab, $content, index);
        }
    },
    showContent: function(index) {
        if ( !! this.config.showCss || !!this.config.hideCss) {
            this.config.tabItems.attr("className", this.config.hideCss);
            this.config.tabItems.get(index).attr("className", this.config.showCss);
        } else {
            this.config.tabItems.removeClass(this.config.tabShowCss);
            this.config.tabItems.get(index).addClass(this.config.tabShowCss);
        }
        if (this.config.contentItems.size() == this.config.tabItems.size()) {
            this.config.contentItems.hide();
            var cur = this.config.contentItems.get(index);
            cur.show();
            var $img = cur.find("img[_src]");
            $img.each(function(e) {
                if (!e.getAttribute("src")) {
                    e.style.visibility = "";
                    e.src = e.getAttribute("_src");
                    e.removeAttribute("_src");
                }
            });
        }
    },
    afterShowContentHandle: function($tab, $content, index) {
        if (typeof this.config.afterShowContent == "function") {
            this.config.afterShowContent($tab, $content, index);
        }
    }
};
Live.SimpleImgShow = function() {
    this.config = {
        showCnt: 6,
        items: null,
        playRight: null,
        playLeft: null,
        curPage: 0,
        disCss: "over",
        leftDisCss: null,
        rightDisCss: null,
        showImgOnInit: true,
        defaultIndex: 0,
        isPolish: true,
        onchange: null
    }
}
Live.SimpleImgShow.prototype = {
    init: function(_config) {
        for (var prop in _config) {
            this.config[prop] = _config[prop];
        }
        var self = this;
        this.config.playRight.bind("mouseup",
        function() {
            self.moveR();
        });
        this.config.playLeft.bind("mouseup",
        function() {
            self.moveL();
        });
        if (this.config.defaultIndex >= 0) {
            this.show(this.config.defaultIndex);
        }
    },
    play: function(offset) {
        if (offset < 0 && this.config.curPage == 0) return;
        if (offset > 0 && this.config.curPage == Math.ceil(this.config.items.size() / this.config.showCnt) - 1) return;
        var istart = 0,
        iend = 0;
        istart = this.config.curPage * this.config.showCnt + offset;
        iend = (this.config.curPage + 1) * this.config.showCnt + offset - 1;
        istart = istart < 0 ? 0 : istart;
        iend = iend > this.config.items.size() - 1 ? this.config.items.size() - 1 : iend;
        if ( !! this.config.isPolish) {
            if (iend - istart + 1 < this.config.showCnt) {
                istart = istart - (this.config.showCnt - (iend - istart)) + 1;
            }
        }
        this.showBySE(istart, iend, offset);
    },
    showBySE: function(istart, iend, offset) {
        for (var i = istart; i <= iend; i++) {
            var $item = this.config.items.get(i);
            if (!$item) return;
            if ( !! this.config.showImgOnInit) {
                var $img = $item.find("img");
                if (!$img.attr("src")) {
                    $img.attr("src", $img.attr("_src"));
                }
            }
            $item.show();
        }
        for (var i = 0; i < istart; i++) {
            this.config.items.get(i).hide();
        }
        for (var i = iend + 1,
        len = this.config.items.elements.length; i < len; i++) {
            this.config.items.get(i).hide();
        }
        if (offset > 0) {
            this.config.curPage += Math.floor(offset / this.config.showCnt);
        } else if (offset < 0) this.config.curPage -= Math.floor(Math.abs(offset) / this.config.showCnt);
        this.setBtn();
        if (typeof this.config.onchange == "function") {
            this.config.onchange(istart, iend, this.config.curPage);
        }
    },
    show: function(tabidx) {
        var istart = 0,
        iend = 0;
        istart = tabidx * this.config.showCnt;
        iend = istart + this.config.showCnt - 1;
        offset = istart - this.config.curPage * this.config.showCnt;
        this.showBySE(istart, iend, offset);
    },
    moveR: function() {
        this.play(this.config.showCnt);
    },
    moveL: function() {
        this.play( - 1 * this.config.showCnt);
    },
    setBtn: function() {
        if (this.config.curPage <= 0) {
            if ( !! this.config.leftDisCss) {
                this.config.playLeft.addClass(this.config.leftDisCss);
            } else {
                this.config.playLeft.addClass(this.config.disCss);
            }
        } else {
            if ( !! this.config.leftDisCss) {
                this.config.playLeft.removeClass(this.config.leftDisCss);
            } else {
                this.config.playLeft.removeClass(this.config.disCss);
            }
        }
        if (this.config.curPage == Math.ceil(this.config.items.size() / this.config.showCnt) - 1) {
            if ( !! this.config.rightDisCss) {
                this.config.playRight.addClass(this.config.rightDisCss);
            } else {
                this.config.playRight.addClass(this.config.disCss);
            }
        } else {
            if ( !! this.config.rightDisCss) {
                this.config.playRight.removeClass(this.config.rightDisCss);
            } else {
                this.config.playRight.removeClass(this.config.disCss);
            }
        }
    }
};
if (typeof(Live.common) == "undefined") {
    Live.common = {};
}
Live.SearchBox = function(_conf) {
    this.config = {
        defaultTxt: "请输入关键词",
        inputBox: null,
        sugSelector: null,
        searchBtn: null,
        searchForm: null,
        sugCover: null,
        callback: {
            onInputboxFocus: Live.emptyFn,
            onInputboxBlur: Live.emptyFn
        }
    };
    Live.object.extend(this.config, _conf);
    this.selectedIndex = -1;
    this.itemsCount = 0;
    this.timer = [];
}
Live.SearchBox.prototype = {
    search_cgi: "",
    search_suggest: "",
    init: function() {
        var self = this;
        var $el = this.config.inputBox;
        $el.val(this.config.defaultTxt);
        if (this.config.inputBox.attr("id") == "iWordFoot") {
            document.sformFoot.onsubmit = function() {
                return self.go();
            }
        }
        if (this.config.inputBox.attr("id") == "iWord") {
            document.sform.onsubmit = function() {
                return self.go();
            }
        }
        this.initSmartBox();
        $el.bind("focus",
        function() {
            var v = QZFL.string.trim($el.val());
            if (v == self.config.defaultTxt) {
                $el.val("");
            } else {
                $el.select();
            }
            $el.addClass("onfocus");
            typeof self.config.callback.onInputboxFocus == 'function' && self.config.callback.onInputboxFocus();
        });
    },
    go: function() {
        txv.log("search go");
        Live.tj2.button("search.btn");
        var val = QZFL.string.trim(this.config.inputBox.val());
        if (val == "" || val == this.config.defaultTxt) {
            return false;
        }
        if (document.charset != 'utf-8' && Live.userAgent.ie) {
            var charset = document.charset;
            document.charset = 'utf-8';
            setTimeout(function() {
                document.charset = charset;
            },
            0);
        }
        document.sform.action = Live.SearchBox.search_cgi;
        if ( !! document.sformFoot) {
            document.sformFoot.action = Live.SearchBox.search_cgi;
        }
        return true;
    },
    resetInputBox: function(resetTxt) {
        var $el = this.config.inputBox;
        var v = QZFL.string.trim($el.val());
        if (v == "" || v == this.config.defaultTxt) {
            if (resetTxt) {
                $el.val(this.config.defaultTxt);
            }
        }
        if ($el.attr("id") == "iWordFoot") {
            $el.attr("class", "foot_search_txt");
        } else {
            $el.attr("class", "mod_search_txt");
        }
    },
    initSmartBox: function() {
        var self = this;
        this.config.inputBox.bind("keyup",
        function(e) {
            if (e.keyCode == 38 || e.keyCode == 40) {
                clearTimeout(self.timer[0]);
                return;
            }
            self.timer[0] = setTimeout(function() {
                clearTimeout(self.timer[0]);
                self.selectedIndex = -1;
                self.getSuggest();
            },
            300);
        });
        this.config.inputBox.bind("keydown",
        function(e) {
            self.resetInputBox(false);
            $e("#iWord").addClass("onfocus");
            if (e.keyCode == 38) {
                self.choose("up", true);
                return;
            } else if (e.keyCode == 40) {
                self.choose("down", true);
                return;
            }
        });
        this.config.inputBox.bind("blur",
        function() {
            self.hideSelector();
            self.resetInputBox(true);
            typeof self.config.callback.onInputboxBlur == 'function' && self.config.callback.onInputboxBlur();
        });
    },
    choose: function(key, fill) {
        fill = fill | false;
        if (typeof key == "string") {
            if (key == "up") {
                if (this.selectedIndex <= 0) {
                    this.selectedIndex = this.itemsCount;
                }
                this.selectedIndex--;
            } else if (key == "down") {
                if (this.selectedIndex >= this.itemsCount - 1) {
                    this.selectedIndex = -1;
                }
                this.selectedIndex++;
            }
        } else if (typeof key == "number") {
            this.selectedIndex = key;
        }
        this.config.sugSelector.find("li.current").removeClass("current");
        var curItem = this.config.sugSelector.find("li:eq(" + this.selectedIndex + ")");
        curItem.addClass("current");
        if ( !! fill) this.config.inputBox.val(curItem.text());
    },
    hideSelector: function() {
        this.config.sugSelector.html("");
        this.config.sugSelector.hide();
        this.config.sugCover.hide();
        if (typeof Live.SearchBox.onHideSelector == "function") {
            Live.SearchBox.onHideSelector();
        }
    },
    getSuggest: function() {
        var self = this;
        var val = QZFL.string.trim(this.config.inputBox.val());
        if (val == "") {
            this.hideSelector();
            return;
        }
        $j.getScript(Live.SearchBox.search_suggest + encodeURIComponent(val),
        function() {
            var QQVideoOutputJson = QZOutputJson;
            var sb = new Live.string.StringBuilder();
            self.itemsCount = QQVideoOutputJson.head.num;
            if (self.itemsCount == 0) {
                self.config.sugSelector.hide();
                self.config.sugCover.hide();
                return;
            }
            try {
                for (var i = 0; i < QQVideoOutputJson.item.length; i++) {
                    sb.appendArray(["<li><a href='#' target='_self'>", QQVideoOutputJson.item[i].w, "<\/a><\/li>"]);
                }
                self.config.sugSelector.html(sb.toString());
                self.config.sugSelector.show();
                self.config.sugCover.css("display", "block");
                setTimeout(function() {
                    var height = self.config.sugSelector.getSize()[1];
                    if (height > 0) {
                        self.config.sugCover.css("height", height + 2 + "px");
                        if (typeof Live.SearchBox.onShowSelector == "function") {
                            Live.SearchBox.onShowSelector();
                        }
                    }
                },
                0);
                self.bindListMouseEvt();
            } catch(e) {
                txv.log(e);
            }
        });
    },
    bindListMouseEvt: function() {
        var self = this;
        this.config.sugSelector.find("li").each(function(el, i) {
            var $el = $e(el);
            $el.bind("mouseover",
            function() {
                self.choose(i);
                self.config.inputBox.unBind("blur");
            });
            $el.bind("mouseout",
            function() {
                self.config.inputBox.bind("blur",
                function() {
                    self.hideSelector();
                });
            });
            $el.bind("click",
            function() {
                self.choose(i, true);
                self.hideSelector();
                self.go();
                if (self.config.inputBox.attr("id") == "iWordFoot") {
                    document.sformFoot.submit();
                } else {
                    document.sform.submit();
                }
            });
        });
    }
};
Live.SearchBox.defaultInit = function(tsearch_cgi, tsearch_suggest, callback) {
    var bIFrm = false;
    this.search_cgi = tsearch_cgi;
    this.search_suggest = tsearch_suggest;
    var conf = {
        inputBox: $e("#iWord"),
        sugSelector: $e("#sgt_list"),
        searchBtn: $e("#sbutton"),
        searchForm: $e("#sform"),
        sugCover: $e("#mod_keywords_list")
    };
    if (typeof callback != 'undefined') {
        conf.callback = callback;
    }
    var isMainNav = $e("#head_main").size() > 0 ? true: false;
    var sb = new Live.SearchBox(conf);
    if (isMainNav) {
        sb.search_suggest = txv.path.search_suggest2;
    }
    if (sb.config.inputBox.attr("id") == "iWord") {
        document.sform.action = Live.SearchBox.search_cgi;
        document.sform.onsubmit = function() {
            this.setAttribute("action", Live.SearchBox.search_cgi);
            return sb.go();
        }
    }
    sb.init();
    if (isMainNav) {
        sb.bindListMouseEvt = function() {
            var self = this;
            this.config.sugSelector.find("li").each(function(el, i) {
                var $el = $e(el);
                $el.bind("mouseover",
                function() {
                    self.choose(i);
                    self.config.inputBox.unBind("blur");
                });
                $el.bind("mouseout",
                function() {
                    self.config.inputBox.bind("blur",
                    function() {
                        self.hideSelector();
                    });
                });
                $el.bind("click",
                function(e) {
                    var act = $el.attr("act");
                    if (act == "click") {
                        var url = $el.attr("playurl");
                        if (url && url != "") {
                            window.open(url);
                        }
                        QZFL.event.preventDefault(e);
                        e.returnValue = false;
                        return;
                    }
                    self.choose(i, true);
                    self.hideSelector();
                    self.go();
                    document.sform.submit();
                    QZFL.event.preventDefault(e);
                    e.returnValue = false;
                });
                $el.find("a").attr("href", "javascript:;");
            });
        }
        sb.getSuggest = function() {
            var self = this;
            var val = QZFL.string.trim(self.config.inputBox.val());
            if (val == "") {
                this.hideSelector();
                return;
            }
            $j.getScript(self.search_suggest + encodeURIComponent(val),
            function() {
                var QQVideoOutputJson = QZOutputJson;
                var sb = new Live.string.StringBuilder();
                self.itemsCount = QQVideoOutputJson.head.num;
                if (self.itemsCount == 0) {
                    self.config.sugSelector.hide();
                    self.config.sugCover.hide();
                    return;
                }
                try {
                    var typemap = {
                        "DY": "1",
                        "LXJ": "2",
                        "MV": "22",
                        "ZY": "10",
                        "JLP": "9"
                    };
                    for (var i = 0; i < QQVideoOutputJson.item.length; i++) {
                        var sitem = QQVideoOutputJson.item[i];
                        var bigtypename = sitem["class"];
                        var siid = sitem["id"];
                        var bigtypeid = -1;
                        if (sitem.ex && sitem.ex.typeid) {
                            bigtypeid = sitem.ex.typeid;
                        }
                        if (siid == "") {
                            sb.appendArray(['<li act="search"><a href="javascript:;" target="_self"><span class="result_title">', sitem.title, '</span></a></li>']);
                        } else {
                            if (bigtypeid == typemap.DY) {
                                if (sitem.url.indexOf("cover") != -1) sitem.url = txv.common.getDetailUrl(sitem.id);
                                sb.appendArray(['<li act="click" playurl="', sitem.url, '"><a href="javascript:;" target="_self"><span class="result_type">（', sitem["class"], '）</span><span class="result_title">', sitem.title, '</span><span class="result_HD">', sitem.sharp, '</span></a> </li>']);
                            } else if (bigtypeid == typemap.LXJ) {
                                if (sitem.url.indexOf("cover") != -1) sitem.url = txv.common.getDetailUrl(sitem.id);
                                sb.appendArray(['<li act="click" playurl="', sitem.url, '"><a href="javascript:;" target="_self"><span class="result_type">（', sitem["class"], '）</span><span class="result_title">', sitem.title, '</span><span class="result_HD">', sitem.sharp, '</span><span class="result_new">', sitem.ex.title, '</span></a></li>']);
                            } else if (bigtypeid == typemap.MV) {
                                sb.appendArray(['<li act="click" playurl="', sitem.url, '"><a href="javascript:;" target="_self"><span class="result_type">（', sitem["class"], '）</span><span class="result_title">', sitem.title, '</span><span class="result_singer">歌手：', sitem.ex.title, '</span><span class="result_HD">', sitem.sharp, '</span></a></li>']);
                            } else if (bigtypeid == typemap.ZY) {
                                sb.appendArray(['<li act="click" playurl="', sitem.url, '"><a href="javascript:;" target="_self"><span class="result_type">（', sitem["class"], '）</span><span class="result_title">', sitem.title, '</span></a></li>']);
                                if (sitem.ex && sitem.ex.id) {
                                    sb.appendArray(['<li act="click" playurl="', txv.common.getDetailUrl(sitem.ex.id, bigtypeid), '"><a href="javascript:;" target="_self"><span class="result_new_info"> - 最新一期 (第', sitem.ex.date.substring(0, 10), '期)</span><span class="result_new_info_detail">', sitem.ex.byname, '</span></a></li>']);
                                    self.itemsCount++;
                                }
                            } else if (bigtypeid == typemap.JLP) {
                                sb.appendArray(['<li act="click" playurl="', sitem.url, '"><a href="javascript:;" target="_self"><span class="result_type">（', sitem["class"], '）</span><span class="result_title">', sitem.title, '</span><span class="result_HD">', sitem.sharp, '</span></a></li>']);
                            } else {
                                sb.appendArray(['<li act="click" playurl="', sitem.url, '"><a href="javascript:;" target="_self"><span class="result_type">（', sitem["class"], '）</span><span class="result_title">', sitem.title, '</span></a></li>']);
                            }
                        }
                    }
                    self.config.sugSelector.html(sb.toString());
                    self.config.sugSelector.show();
                    self.config.sugCover.css("display", "block");
                    setTimeout(function() {
                        var height = self.config.sugSelector.getSize()[1];
                        if (height > 0) {
                            self.config.sugCover.css("height", height + 2 + "px");
                            if (typeof Live.SearchBox.onShowSelector == "function") {
                                Live.SearchBox.onShowSelector();
                            }
                        }
                    },
                    0);
                    self.bindListMouseEvt();
                } catch(e) {
                    txv.log(e);
                }
            });
        }
        sb.choose = function(key, fill) {
            fill = fill | false;
            if (typeof key == "string") {
                if (key == "up") {
                    if (this.selectedIndex <= 0) {
                        this.selectedIndex = this.itemsCount;
                    }
                    this.selectedIndex--;
                } else if (key == "down") {
                    if (this.selectedIndex >= this.itemsCount - 1) {
                        this.selectedIndex = -1;
                    }
                    this.selectedIndex++;
                }
            } else if (typeof key == "number") {
                this.selectedIndex = key;
            }
            this.config.sugSelector.find("li.current").removeClass("current");
            var curItem = this.config.sugSelector.find("li:eq(" + this.selectedIndex + ")");
            curItem.addClass("current");
            if ( !! fill && (curItem.getAttr("act") == "search" || curItem.getAttr("act") == "click")) this.config.inputBox.val(curItem.find(".result_title").text());
        }
        sb.go = function() {
            Live.tj2.button("search.search");
            if (this.config.sugSelector.html() != "" && this.selectedIndex != -1) {
                var curItem = this.config.sugSelector.find("li:eq(" + this.selectedIndex + ")");
                var act = curItem.attr("act");
                if (act == "click") {
                    var url = curItem.attr("playurl");
                    if (url && url != "") {
                        window.open(url);
                    }
                    return false;
                }
            }
            var val = QZFL.string.trim(this.config.inputBox.val());
            if (val == "" || val == this.config.defaultTxt) {
                return false;
            }
            if (document.charset != 'utf-8' && Live.userAgent.ie) {
                var charset = document.charset;
                document.charset = 'utf-8';
                setTimeout(function() {
                    document.charset = charset;
                },
                0);
            }
            return true;
        }
    }
    if ($e("#sformFoot").size() == 1) {
        var confFoot = {
            inputBox: $e("#iWordFoot"),
            sugSelector: $e("#sgt_list_foot"),
            searchBtn: $e("#sbuttonFoot"),
            searchForm: $e("#sformFoot"),
            sugCover: $e("#mod_keywords_list_foot")
        };
        if (typeof callback != 'undefined') {
            confFoot.callback = callback;
        }
        var sbFoot = new Live.SearchBox(confFoot);
        sbFoot.init();
    }
};
Live.SearchBox.onShowSelectorEventList = [];
Live.SearchBox.onHideSelectorEventList = [];
Live.SearchBox.addOnShowSelectorCallBack = function(fn) {
    if (typeof fn == "function") {
        Live.SearchBox.onShowSelectorEventList.push(fn);
    }
}
Live.SearchBox.addOnHideSelectorCallBack = function(fn) {
    if (typeof fn == "function") {
        Live.SearchBox.onHideSelectorEventList.push(fn);
    }
}
Live.SearchBox.onShowSelector = function() {
    if (QZFL.lang.isArray(Live.SearchBox.onShowSelectorEventList)) {
        for (var idx = 0,
        len = Live.SearchBox.onShowSelectorEventList.length; idx < len; idx++) {
            if (typeof Live.SearchBox.onShowSelectorEventList[idx] == "function") {
                Live.SearchBox.onShowSelectorEventList[idx]();
            }
        }
    }
}
Live.SearchBox.onHideSelector = function() {
    if (QZFL.lang.isArray(Live.SearchBox.onHideSelectorEventList)) {
        for (var idx = 0,
        len = Live.SearchBox.onHideSelectorEventList.length; idx < len; idx++) {
            if (typeof Live.SearchBox.onHideSelectorEventList[idx] == "function") {
                Live.SearchBox.onHideSelectorEventList[idx]();
            }
        }
    }
}
Live.FloatMenu = function(config) {
    this.mark1 = false;
    this.mark2 = false;
    this.area = null;
    this.menu = null;
    this.areaOutdelay = 500;
    this.menuOutdelay = 100;
    this.onShow = null;
    this.onHide = null;
    var self = this;
    for (var prop in config) {
        this[prop] = config[prop];
    }
    this.area.bind("mouseover",
    function() {
        self.mark1 = true;
        self.showMenu();
    });
    this.menu.bind("mouseover",
    function(e) {
        self.mark2 = true;
        self.showMenu();
    });
    this.area.bind("mouseout",
    function() {
        self.mark1 = false;
        setTimeout(function() {
            self.hideMenu();
        },
        self.areaOutdelay);
    });
    this.menu.bind("mouseout",
    function(e) {
        self.mark2 = false;
        setTimeout(function() {
            self.hideMenu();
        },
        self.menuOutdelay);
    });
};
Live.FloatMenu.prototype = {
    showMenu: function() {
        if (this.mark1 || this.mark2) {
            if (this.onShow) {
                this.onShow(this);
            }
            this.menu.show();
        } else {}
    },
    hideMenu: function() {
        if (! (this.mark1 || this.mark2)) {
            if (this.onHide) {
                this.onHide(this);
            }
            this.menu.hide();
        }
    },
    getEventTarget: function(e) {
        e = e || window.event;
        return e.target || e.srcElement;
    }
};
Live.retCode = {
    snid: 0,
    TYPE: {
        SUC: 1,
        ERR: 2
    },
    config: {
        cgi: "http://isdspeed.qq.com/cgi-bin/v.cgi",
        sampling: 1
    },
    commCode: {
        error: 11,
        MQzone_Err: 12
    },
    report: function(appid, rettype, delay, errcode) {
        if (!appid) return;
        if (isNaN(rettype) || rettype < 1) return;
        if (typeof delay == "undefined") return;
        var url = this.config.cgi;
        url += "?flag1=" + appid.toString() + "&flag2=" + rettype.toString() + "&1=" + Live.retCode.config.sampling + "&2=" + delay;
        if (errcode) url += "&flag3=" + errcode.toString();
        var imgSend = new Image();
        imgSend.src = url;
    }
};
Live.RetCode = function(appid) {
    this.appid = appid;
    this.timer = {
        begin: 0,
        end: 0
    }
    this.SNID = Live.retCode.snid;
    this.isReported = false;
    Live.retCode.snid++;
}
Live.RetCode.prototype = {
    begin: function() {
        this.timer.begin = new Date().valueOf();
    },
    end: function() {
        this.timer.end = this.timer.end || new Date().valueOf();
    },
    reprot: function(rettype, retcode) {
        if (this.isReported) return;
        this.end();
        var delay = this.timer.end - this.timer.begin;
        Live.retCode.report(this.appid, rettype, delay, retcode);
        this.isReported = true;
    },
    reprotSuc: function() {
        this.reprot(Live.retCode.TYPE.SUC);
    },
    reportErr: function(errcode) {
        errcode = errcode || Live.retCode.commCode.error;
        this.reprot(Live.retCode.TYPE.ERR, errcode);
    }
};
Live = Live || {};
Live.txv = {
    isLoaded: false,
    ver: "$Rev: 11343 $",
    lastmodify: "$Date: 2011-09-29 10:37:23 +0800 (周四, 29 九月 2011) $",
    isDebug: false
};
var txv = window.txv = Live.txv;
Live.tj2.keyPrefix = "txv.";
Live.virtualpgv.virtualPath = "/txv/";
if (QZFL && QZFL.object) {
    QZFL.object.extend(Live, {
        inArray: function(elem, array) {
            if (Live.object.getType(array) != "array") return - 1;
            for (var i = 0,
            length = array.length; i < length; i++) {
                if (array[i] === elem) return i;
            }
            return - 1;
        }
    });
    if (location.hostname != "v.qq.com" || (QZFL.userAgent.ie && QZFL.userAgent.ie < 8)) {
        QZFL.Storage.helperUrl = "http://v.qq.com/storage_helper.html";
        QZFL.Storage.setOptions({
            share: true
        });
    }
}
Live.txv.path = {
    trimpath: "http://imgcache.qq.com/tencentvideo_v1/js/trimpath.min.js",
    filmCritic: "http://sns.video.qq.com/fcgi-bin/liveportal/getfilmcritic?otype=json",
    userComment: "http://sns.video.qq.com/fcgi-bin/liveportal/comment?otype=json",
    videoInfo: "http://sns.video.qq.com/tvideo/fcgi-bin/video?otype=json",
    videoTagInfo: "http://sns.video.qq.com/tvideo/fcgi-bin/vtag?otype=json",
    search_cgi: "http://v.qq.com/search.html?mi_pagenum=0&ms_search_type=1&ms_sort=0&ms_mode=0&pagetype=3",
    search_suggest: "http://sns.video.qq.com/fcgi-bin/soso_suggestion?sm_category=3&sm_need_num=10&otype=json&sm_key=",
    search_suggest2: "http://ncgi.video.qq.com/tvideo/fcgi-bin/smartbox?num=10&otype=json&query=",
    pingfencgi: "http://sns.video.qq.com/fcgi-bin/portalscore?otype=json",
    favouritecgi: "http://sns.video.qq.com/fcgi-bin/liveportal/favorite",
    weiboget: "http://sns.video.qq.com/tvideo/fcgi-bin/opmicroblog?otype=json",
    weiboSend: "http://sns.video.qq.com/tvideo/fcgi-bin/pubmblog",
    weiboSend_2: "http://sns.video.qq.com/tvideo/fcgi-bin/livepubmblog4po",
    videoRelate: "http://sns.video.qq.com/tvideo/fcgi-bin/relatedvideo?otype=json",
    singerMVList: "http://sns.video.qq.com/tvideo/fcgi-bin/GetSingerMV?otype=json",
    flashReport: "http://rcgi.video.qq.com/tencentvideo_report?",
    html5_video_cgi: "http://vv.video.qq.com/geturl?otype=json",
    addMvMusicBox: "http://s.plcloud.music.qq.com/fcgi-bin/fcg_mvlist_add.fcg",
    queryMvMusicBox: "http://s.plcloud.music.qq.com/fcgi-bin/fcg_mvlist_isadded.fcg",
    delMvMusicBox: "http://s.plcloud.music.qq.com/fcgi-bin/fcg_mvlist_mod.fcg",
    mvMusicFav: "http://qzone-music.qq.com/fcg-bin/fcg_mvlist_add.fcg",
    videoViewNum: "http://sns.video.qq.com/tvideo/fcgi-bin/viewnum?otype=json",
    getCoverInfo: "http://sns.video.qq.com/fcgi-bin/coverdetail?otype=json",
    hls_video_cgi: "http://vv.video.qq.com/gethls?otype=json&format=2",
    coverViewNum: "http://sns.video.qq.com/fcgi-bin/dlib/dataout_pc?auto_id=55&otype=json",
    videoRecommend: "http://sns.video.qq.com/fcgi-bin/dlib/dataout_pc?auto_id=163&otype=json",
    bokeplayhost: "play.v.qq.com",
    kid_list_autodata: "http://sns.video.qq.com/fcgi-bin/dlib/dataout_pc?auto_id=53&",
    bookcgi: "http://sns.video.qq.com/fcgi-bin/liveportal/nbook",
    getBookCgi: 'http://sns.video.qq.com/fcgi-bin/liveportal/norder',
    recommendCgi: "http://sns.video.qq.com/tvideo/fcgi-bin/spvote",
    queryHistoryRecordCgi: "http://ncgi.video.qq.com/tvideo/fcgi-bin/myview",
    addHistoryRecordCgi: "http://rcgi.video.qq.com/report/myviewreport",
    batchgetscoreCgi: "http://sns.video.qq.com/tvideo/fcgi-bin/batchgetscore",
    batchgetplaymount: "http://sns.video.qq.com/tvideo/fcgi-bin/batchgetplaymount",
    myopnumCgi: "http://ncgi.video.qq.com/tvideo/fcgi-bin/myopnum",
    getVideoListCgi: "http://c.v.qq.com/vuserinfor",
    getUserULikeCgi: "http://sns.video.qq.com/tvideo/fcgi-bin/favVideo",
    userOrderListCgi: "http://pay.video.qq.com/fcgi-bin/order",
    myinterestCgi: "http://ncgi.video.qq.com/tvideo/fcgi-bin/myinterest",
    getVideoRecommonCgi: "http://sns.video.qq.com/tvideo/fcgi-bin/mediacommend",
    getCoverRecommonCgi: "http://sns.video.qq.com/fcgi-bin/dlib/dataout_pc?auto_id=162&",
    getUserUploadVideoNumCgi: "http://c.v.qq.com/uvcount"
};
Live.txv.login = {
    _imgObj: null,
    config: {
        appid: "532001601",
        uinCookie: "uin",
        encuinCookie: "encuin",
        nickCookie: "lw_nick",
        quickLogin: true,
        jumpurl: "",
        clientjumpurl: null,
        showMask: true,
        success: null,
        logout: null,
        rejectLogin: null,
        login_cgi: "http://c.video.qq.com/cgi-bin/login?otype=json",
        show_uniq: false,
        show_content: ""
    },
    _loginEvtList: [],
    _logoutEvtList: [],
    onShowMask: null,
    onHideMask: null,
    _openLoginEvtList: [],
    _closeLoginEvtList: [],
    init: function(_config, iscallback) {
        iscallback = !!iscallback;
        Live.object.extend(this.config, _config);
        txv.login.setStatus(iscallback, false);
    },
    ReTryType: {
        openclient: 1,
        reloadcgi: 2
    },
    isOpend: false,
    isLogin: function() {
        return (txv.login.getUin() > 10000);
    },
    setStatus: function(iscallback, reloadnick) {
        if (txv.login.getUin() == 0) {
            txv.login.logout();
            return;
        }
        if (txv.login.getNick() == "" || reloadnick == true) {
            $j.getScript(txv.login.config.login_cgi + "&_=" + new Date().valueOf() + "&g_tk=" + $j.getToken(),
            function() {
                if (typeof QZOutputJson != "undefined") {
                    if (QZOutputJson.result && QZOutputJson.result.code == "0") {
                        if (typeof QZOutputJson.encuin != "undefined") {
                            if (location.host.indexOf("qq.com") >= 0) {
                                Live.cookie.set(txv.login.config.encuinCookie, QZOutputJson.encuin + "|" + txv.login.getUin(), location.host, "/");
                            }
                        }
                        if (typeof QZOutputJson.nick != "undefined") {
                            if (location.host.indexOf("qq.com") >= 0) {
                                Live.cookie.set(txv.login.config.nickCookie, QZOutputJson.nick + "|" + txv.login.getUin(), location.host, "/");
                            }
                            txv.login.showOnline();
                            if (iscallback != false && typeof txv.login.config.success == "function") {
                                txv.login.config.success();
                            }
                            Live.txv.login._fireLoginCallback();
                        } else {
                            txv.login.showOnline();
                        }
                    } else if (QZOutputJson.result && QZOutputJson.result.code != "0") {
                        if (QZOutputJson.result.code == "100001") {
                            txv.login.logout();
                        } else if (QZOutputJson.result.code == "2504") {
                            txv.login.showOnline();
                        }
                    }
                } else {
                    txv.login.logout();
                }
            });
            txv.login._imgObj = new Image();
            txv.login._imgObj.src = "http://sns.video.qq.com/tvideo/fcgi-bin/loginstat";
        } else {
            txv.login.showOnline();
            if (iscallback == true && typeof txv.login.config.success == "function") {
                txv.login.config.success();
            }
            Live.txv.login._fireLoginCallback();
        }
    },
    getUin: function() {
        if (Live.string.trim(Live.cookie.get("skey")) == "") {
            return 0;
        }
        var uin = parseInt(Live.cookie.get(txv.login.config.uinCookie).replace(/^o0*/g, ""), 10);
        if (uin <= 10000) {
            return 0;
        }
        return uin;
    },
    getEncUin: function() {
        if (Live.string.trim(Live.cookie.get("skey")) == "") {
            return "";
        }
        var n = Live.cookie.get(txv.login.config.encuinCookie);
        if (n == "") {
            return n;
        }
        var arr = n.split("|");
        if (arr[1] && arr[1] == this.getUin()) return decodeURIComponent(arr[0]);
        return "";
    },
    getNick: function() {
        if (Live.string.trim(Live.cookie.get("skey")) == "") {
            return "";
        }
        var n = Live.cookie.get(txv.login.config.nickCookie);
        if (n == "") {
            return n;
        }
        var arr = n.split("|");
        if (arr[1] && arr[1] == this.getUin()) return decodeURIComponent(arr[0]);
        return "";
    },
    showOnline: function(isShowNick) {
        var login_nick = $e("#login_nick");
        login_nick.text(txv.login.getNick());
        var login_action = $e("#login_action");
        login_action.text("[退出]");
        login_action.unBind("click");
        login_action.bind("click", txv.login.logout);
    },
    showNotLogin: function() {
        var login_nick = $e("#login_nick");
        login_nick.text("");
        var login_action = $e("#login_action");
        login_action.text("登录");
        login_action.unBind("click");
        login_action.bind("click", txv.login.openLogin);
    },
    showMask: function(centerId, w, h) {
        if (!$("mask_layer")) {
            $e("body").create("div", {
                "id": "mask_layer",
                "class": "mask_layer"
            });
            if (Live.userAgent.ie == 6) {
                $e("#mask_layer").css("height", document.documentElement.scrollHeight);
            }
        } else {
            $e("#mask_layer").show();
        }
        if (!txv.common.useHtml5()) {
            if (Live.userAgent.ie == 7 || !Live.userAgent.ie) {
                var scorllObj = !!Live.userAgent.ie ? "body": document;
                $e(scorllObj).bind("scroll",
                function() {
                    txv.login.showAtCenter($(centerId), w, h);
                })
            } else {
                window.onscroll = function() {
                    txv.login.showAtCenter($(centerId), w, h);
                }
            }
        }
        if (typeof txv.login.onShowMask == "function") {
            txv.login.onShowMask();
        }
    },
    hideMask: function() {
        $e("#mask_layer").hide();
        if (Live.userAgent.ie == 7 || !Live.userAgent.ie) {
            var scorllObj = !!Live.userAgent.ie ? "body": document;
            $e(scorllObj).unBind("scroll");
        } else {
            window.onscroll = Live.emptyFn;
        }
        if (typeof txv.login.onHideMask == "function") {
            txv.login.onHideMask();
        }
    },
    openLogin: function(_config) {
        txv.login.isOpend = true;
        Live.object.extend(txv.login.config, _config);
        var jumpurl = txv.login.config.jumpurl;
        var clientjumpurl = txv.login.config.clientjumpurl;
        if (txv.login.config.showMask && !txv.common.useHtml5()) {
            txv.login.showMask("login_win");
        }
        if ($("login_win") == null) {
            $e("body").create("div", {
                "id": "login_win",
                "innerHTML": "<iframe name=\"_login_frame_quick_\" id=\"_login_frame_quick_\" frameborder=\"no\" scrolling=\"no\" width=\"100%\" height=\"100%\" src=\"about:blank\"><\/iframe>"
            });
        }
        var loginwin = $("login_win");
        loginwin.style.display = "none";
        var url = "";
        window.__j_url = clientjumpurl;
        url = ["http://ui.ptlogin2.qq.com/cgi-bin/login?link_target=blank&target=self&appid=", txv.login.config.appid, "&f_url=loginerroralert&qlogin_auto_login=0", "&s_url=", escape("http://imgcache.qq.com/liveportal_v1/toolpages/redirect.html?clientjumpurl=" + escape(clientjumpurl || window.location.href) + "&jumpurl=" + jumpurl)].join('');
        $("_login_frame_quick_").src = url;
        txv.login.showAtCenter(loginwin);
        txv.login._fireOpenLoginCallback();
    },
    showAtCenter: function(loginwin, w, h) {
        if (!loginwin) return;
        var scrhei = document.body.scrollTop;
        w = w || 373;
        h = h || 235;
        if (0 == scrhei) scrhei = document.documentElement.scrollTop;
        var clihei = document.documentElement.clientHeight;
        if (0 == clihei) clihei = document.body.clientHeight;
        loginwin.style.width = w + "px";
        loginwin.style.height = h + "px";
        loginwin.style.top = (clihei / 2 + scrhei) - h / 2 + "px";
        loginwin.style.left = (document.body.scrollWidth - w) / 2 + "px";
        loginwin.style.position = "absolute";
        loginwin.style.zIndex = "10001";
        loginwin.style.display = "block";
        loginwin.style.padding = "0px";
        if (txv.common.useHtml5()) {
            document.documentElement.scrollTop = 0;
        }
    },
    logout: function(evt) {
        Live.cookie.set("uin", "", ".qq.com", "/", -24);
        Live.cookie.set(txv.login.config.nickCookie, "", location.host, "/", -24);
        Live.cookie.set(txv.login.config.encuinCookie, "", location.host, "/", -24);
        Live.cookie.set("skey", "", ".qq.com", "/", -24);
        txv.login.showNotLogin();
        if (typeof txv.login.config.logout == "function") {
            txv.login.config.logout(evt);
        }
        Live.txv.login._fireLogoutCallback(evt);
    },
    addLoginCallback: function(fn) {
        if (typeof fn == "function") {
            Live.txv.login._loginEvtList.push(fn);
        }
    },
    addLogoutCallback: function(fn) {
        if (typeof fn == "function") {
            Live.txv.login._logoutEvtList.push(fn);
        }
    },
    addOpenLoginCallback: function(fn) {
        if (typeof fn == "function") {
            Live.txv.login._openLoginEvtList.push(fn);
        }
    },
    addCloseLoginCallback: function(fn) {
        if (typeof fn == "function") {
            Live.txv.login._closeLoginEvtList.push(fn);
        }
    },
    _fireEvt: function(evtList, evt) {
        if (!evtList) return;
        for (var i = 0,
        len = evtList.length; i < len; i++) {
            if (typeof evtList[i] == "function") {
                evtList[i].call(window, evt);
            }
        }
    },
    _fireLoginCallback: function(evt) {
        Live.txv.login._fireEvt(Live.txv.login._loginEvtList, evt);
    },
    _fireLogoutCallback: function(evt) {
        Live.txv.login._fireEvt(Live.txv.login._logoutEvtList);
    },
    _fireOpenLoginCallback: function(evt) {
        Live.txv.login._fireEvt(Live.txv.login._openLoginEvtList, evt);
    },
    _fireCloseLoginCallback: function(evt) {
        Live.txv.login._fireEvt(Live.txv.login._closeLoginEvtList, evt);
    }
};
function ptlogin2_onResize(width, height) {
    $("_login_frame_quick_").style.height = height + "px";
    $("_login_frame_quick_").style.width = width + "px";
    txv.login.showAtCenter($("login_win"), width, height);
}
function ptlogin2_onClose(isSuc) {
    $e("#login_win").remove();
    txv.login.isOpend = false;
    txv.login.hideMask();
    if (isSuc) {
        ptlogin2_onSuccess();
    } else {
        if (typeof(txv.login.config.rejectLogin) == "function") {
            txv.login.config.rejectLogin();
        }
    }
    txv.login._fireCloseLoginCallback();
}
function ptlogin2_onSuccess() {
    txv.login.setStatus(true, true);
}
function __rdt__() {
    if ( !! __j_url) while (__j_url.indexOf('%') != -1 && __j_url.indexOf('?') == -1) {
        __j_url = unescape(__j_url);
    } else {
        window.location.reload();
    }
    window.location.href = __j_url;
}
Live.txv = Live.txv || {};
Live.txv.log = function(msg) {
    if (txv.log.isdebug == 1) {
        QZFL.console.print(msg);
        return;
    }
    if (txv.log.isdebug == -1) {
        txv.log.isdebug = (txv.common.getUrlParam("debug") == "true") ? 1 : 0;
    }
    if (txv.log.isdebug == 1) {
        QZFL.console.print(msg);
    }
}
Live.txv.dump = function(obj) {
    if (txv.log.isdebug == 1 && typeof console == "object") {
        console.dir(obj);
        return;
    }
    if (txv.log.isdebug == -1) {
        txv.log.isdebug = (txv.common.getUrlParam("debug") == "true") ? 1 : 0;
    }
    if (txv.log.isdebug == 1 && typeof console == "object") {
        console.dir(obj);
    }
}
Live.txv.log.isdebug = -1;
Live.txv.common = {
    rootPath: "",
    conf: {
        needGoToLoginPage: true
    },
    getUrlParam: function(p, u) {
        u = u || document.location.toString();
        var reg = new RegExp("(^|&|\\\\?)" + p + "=(.*?)(&|$|#)");
        var r;
        if (r = u.match(reg)) return r[2];
        return "";
    },
    initPage: function(extData) {
        txv.log("init page");
        if ( !! txv.common.initPageFlag) {
            return;
        }
        txv.common.initPageFlag = true;
        txv.common.initMainHead();
        txv.common.initSimpHead();
        txv.common.initSearchBar();
        txv.common.initMytvMenu();
        txv.login.init(( !! extData && !!extData.login) ? extData.login: null, true);
        var playPageFlag = QZFL.object.getType(extData) == "object" && extData.playPageFlag ? extData.playPageFlag: false;
        if (playPageFlag == true) {
            txv.common.conf.needGoToLoginPage = false;
        }
        txv.history.init(playPageFlag);
        if (txv.common.isWebqq()) {
            $e(".mod_login").hide();
            $e("a").attr("target", "_self");
            var searchform = document.sform;
            if ( !! searchform) {
                searchform.target = "_self";
            }
        }
        Live.lazyLoad.init(["img"]);
        if ( !! extData && extData.watch == true) {
            Live.tj2.watch();
        }
        if ( !! extData && !!extData.tj2 && !!extData.tj2.forbidden) {
            txv.log("not report pv on initpage");
        } else {
            Live.tj2.pv(( !! extData && !!extData.tj2) ? extData.tj2: null);
        }
        txv.common.initPageHotKey();
    },
    initMainHead: function() {
        if ($("head_main")) {
            $j.ajax({
                url: "http://v.qq.com/json/advertise.json",
                jsonCache: 600,
                dataType: "script",
                success: function() {
                    if (typeof(advlist) != 'undefined' && typeof(advlist) != null) {
                        if (advlist.adv.flag == 1) {
                            $e("#head_main>.mod_inner").addClass("has_top_ads");
                            var img = document.createElement("img");
                            var mod_adimg = $("adimg");
                            img.setAttribute("src", advlist.adv.pic);
                            img.setAttribute("alt", advlist.adv.title);
                            img.setAttribute("_hot", "nav.logo.img");
                            img.style.height = "80px";
                            if (mod_adimg && "setAttribute" in mod_adimg) {
                                mod_adimg.appendChild(img);
                                mod_adimg.setAttribute("href", advlist.adv.url);
                                mod_adimg.setAttribute("title", advlist.adv.title);
                            }
                        }
                        var mod_links = $("adlinks");
                        if (mod_links) {
                            mod_links.innerHTML = advlist.links;
                        }
                    }
                },
                error: function() {}
            });
            var mod_login = $("login_action");
            var mytvPage = "/mytv/index.html";
            if (mod_login && "setAttribute" in mod_login) {
                txv.login.addLoginCallback(function() {
                    var mod_login = $("login_action");
                    if (mod_login && "setAttribute" in mod_login) {
                        mod_login.removeAttribute("_hot");
                    }
                    $e("#login_text").html(["<a href=\"", mytvPage, "\" target=\"_blank\">", QZFL.string.filterAngAndQt(txv.login.getNick()), " (", txv.login.getUin(), ")", "</a>"].join(""));
                });
                txv.login.addLogoutCallback(function(evt) {
                    var mod_login = $("login_action");
                    if (mod_login && "setAttribute" in mod_login) {
                        mod_login.setAttribute("_hot", "nav.login");
                    }
                    var target = QZFL.event.getTarget(evt);
                    if (target && target.id == "login_action") {
                        txv.common.btnTj("nav.logout");
                        QZFL.event.cancelBubble(evt);
                    }
                    $e("#login_text").html("");
                });
                if (txv.login.isLogin()) {
                    $e("#login_text").html(["<a href=\"", mytvPage, "\" target=\"_blank\">", QZFL.string.filterAngAndQt(txv.login.getNick()), " (", txv.login.getUin(), ")", "</a>"].join(""));
                    mod_login.removeAttribute("_hot");
                }
            }
            txv.common.initDownloadMenu();
        }
    },
    initDownloadMenu: function() {
        var $mod = $e("#mod_download");
        var menu = new Live.FloatMenu({
            menu: $mod.find(".mod_pop"),
            area: $e('#mod_open_download'),
            areaOutdelay: 100,
            onShow: function(obj) {
                $mod.addClass("open");
            },
            onHide: function(obj) {
                $mod.removeClass("open");
            }
        });
        $mod.delegate("a", "click",
        function() {
            Live.tj2.button("nav.download");
        });
    },
    initPageHotKey: function() {
        $e(".mod_nav a").each(function() {
            var $el = $e(this);
            $el.bind("click",
            function() {
                var path = $el.attr("href").replace("http://" + window.location.host, "").replace(".html", "").replace("index", "").replace(/\//g, "");
                path = path || "index";
                if ( !! path) {
                    Live.tj2.button("nav." + path);
                }
            });
        });
        $e(".mod_nav_simple a").each(function() {
            var $el = $e(this);
            $el.bind("click",
            function() {
                var path = $el.attr("href").replace("http://" + window.location.host, "").replace(".html", "").replace("index", "").replace(/\//g, "");
                path = path || "index";
                if ( !! path) {
                    Live.tj2.button("simpnav." + path);
                }
            });
        });
        $e(document).undelegate("[_hot]", "click").delegate("[_hot]", "click",
        function() {
            var hot = "",
            parentNode;
            if (QZFL.lang.isElement(this)) {
                hot = this.getAttribute("_hot");
                if (hot) {
                    txv.common.btnTj(hot);
                }
            }
        });
    },
    initSimpHead: function() {
        var $head_simple = $e("#head_simple");
        if ($head_simple.size() == 1) {
            var $mod_simpl_nav_login = $e("#mod_simpl_nav_login");
            var myhome = $e("#myhome");
            var $moreLinkCont = $e(".mod_nav_simple .mod_nav_pop");
            if (txv.login.isLogin()) {
                $e("#simpl_nav_nick").text(txv.login.getNick());
                $mod_simpl_nav_login.hide();
                myhome.show();
            }
            $head_simple.delegate("#simpl_nav_login", "click", txv.login.openLogin);
            $head_simple.delegate("#simpl_nav_logout", "click",
            function(evt) {
                QZFL.event.preventDefault(evt) txv.login.logout();
            });
            txv.login.addLoginCallback(function() {
                $mod_simpl_nav_login.hide();
                $e("#simpl_nav_nick").text(txv.login.getNick());
                myhome.show();
            });
            txv.login.addLogoutCallback(function() {
                myhome.hide();
                $mod_simpl_nav_login.show();
            });
            if ($moreLinkCont.size() > 0) {
                var menu = new Live.FloatMenu({
                    menu: $moreLinkCont.find(".mod_pop"),
                    area: $moreLinkCont,
                    areaOutdelay: 100,
                    onShow: function(obj) {
                        $moreLinkCont.addClass("open");
                    },
                    onHide: function(obj) {
                        $moreLinkCont.removeClass("open");
                    }
                });
            }
        }
    },
    initSearchBar: function() {
        var $mod_search = $e("#mod_search");
        if ($mod_search.size() == 1) {
            $mod_search.removeClass("open");
            Live.SearchBox.defaultInit(txv.path.search_cgi, txv.path.search_suggest, {
                onInputboxFocus: function() {
                    $mod_search.addClass("open");
                },
                onInputboxBlur: function() {
                    $mod_search.removeClass("open");
                }
            });
        } else {
            Live.SearchBox.defaultInit(txv.path.search_cgi, txv.path.search_suggest);
        }
        var $search = $e("fieldset.mod_search p");
        if ( !! $search) {
            $search.bind("mouseover",
            function() {
                $e(this).addClass("focus");
            }) $search.bind("mouseout",
            function() {
                $e(this).removeClass("focus");
            })
        }
    },
    initMytvMenu: function() {
        var pop = $e("#myhome_pop");
        if (pop.size() == 0) return;
        var myhome = $e("#myhome");
        txv.nav = {};
        txv.nav.myhome = {};
        txv.nav.myhome.onShowMenu = QZFL.emptyFn;
        txv.nav.myhome.onHideMenu = QZFL.emptyFn;
        if (myhome.elements.length) {
            var menu = new Live.FloatMenu({
                menu: pop,
                area: myhome.find("h6 a"),
                areaOutdelay: 100,
                onShow: function(obj) {
                    myhome.addClass("open");
                    txv.nav.myhome.onShowMenu();
                },
                onHide: function(obj) {
                    myhome.removeClass("open");
                    txv.nav.myhome.onHideMenu();
                }
            });
        }
    },
    bindBtnTj: function() {
        $e("._hotkey").bind("click",
        function() {
            txv.common.btnTj(this.getAttribute("_hot"));
        });
    },
    btnTj: function(key) {
        Live.tj2.button(key);
    },
    isIframe: function() {
        return (window != top);
    },
    isWebqq: function() {
        if (!txv.common.isIframe()) return false;
        try {
            if (typeof top.webqq != "undefined") {
                return true;
            }
        } catch(e) {
            return false;
        }
    },
    showDevImg: function() {},
    getDetailUrl: function(coverid, typeid) {
        typeid = typeid || 0;
        var pathname = "";
        if (typeid == 0 || Live.inArray(typeid, [1, 2, 98]) >= 0) {
            pathname = "/detail/";
        } else {
            pathname = "/cover/";
        }
        return [txv.common.rootPath, pathname, coverid.charAt(0), "/", coverid, ".html"].join("");
    },
    getPlayUrl: function(id, videoid) {
        if (!id) return "";
        if (id.length == 15) {
            var str = [txv.common.rootPath, "/cover/", id.charAt(0), "/", id, ".html"].join("");
            if ( !! videoid) {
                str += "?vid=" + videoid;
            }
            return str;
        } else {
            return txv.common.getVideoPlayUrl(id);
        }
    },
    getPrevUrl: function(id, videoid, typeid) {
        if (typeof typeid == "undefined" || !typeid) {
            typeid = 0;
        }
        var str = [txv.common.rootPath, (typeid <= 2 ? "/prev/": "/cover/"), id.charAt(0), "/", id].join("");
        if ( !! videoid) {
            if (typeid == 2) {
                str += "/" + videoid + ".html";
            } else {
                str += ".html?vid=" + videoid;
            }
        } else {
            str += ".html";
        }
        return str;
    },
    getVideoPlayUrl: function(vid) {
        if (typeof(vid) !== "string" || vid.length < 11) {
            return "";
        }
        return [txv.common.rootPath, "/page/", vid.substr(0, 1), "/", vid.substr(9, 1), "/", vid.substr(10, 1), "/", vid, ".html"].join("");
    },
    getBokePlayUrl: function(vid) {
        if (typeof(vid) !== "string" || vid.length < 11) {
            return "";
        }
        return [txv.common.rootPath, "/boke/page/", vid.substr(0, 1), "/", vid.substr(9, 1), "/", vid.substr(10, 1), "/", vid, ".html"].join("");
    },
    filterUrlPramaVid: function(vid) {
        if ( !! vid) {
            var pVidOk = true;
            var pVids = vid.split("|");
            for (var i = 0; i < pVids.length; i++) {
                var v = pVids[i].split("_");
                if (v[0].length != 11 || (v.length == 2 && isNaN(v[1])) || v.length > 2) {
                    pVidOk = false;
                    break;
                }
            }
            if (pVidOk) {
                return vid;
            } else {
                return "";
            }
        }
        return "";
    },
    getStaticPlayUrl: function(cid, vid) {
        var str = [txv.common.rootPath, "/cover/", cid.charAt(0), "/", cid, ".html?vid=", vid].join("");
        return str;
    },
    getPayUrl: function(cid) {
        return ["/pay/newpay.html?id=", cid].join("");
    },
    getVideoSnap: function(lpszVID, idx) {
        var szPic;
        var uin;
        var hash_bucket = 10000 * 10000;
        var object = lpszVID;
        if (lpszVID.indexOf("_") > 0) {
            var arr = lpszVID.split("_");
            lpszVID = arr[0];
            idx = parseInt(arr[1]);
        }
        var uint_max = 0x00ffffffff + 1;
        var hash_bucket = 10000 * 10000;
        var tot = 0;
        for (var inx = 0; inx < lpszVID.length; inx++) {
            var nchar = lpszVID.charCodeAt(inx);
            tot = (tot * 32) + tot + nchar;
            if (tot >= uint_max) tot = tot % uint_max;
        }
        uin = tot % hash_bucket;
        if (idx == undefined) idx = 0;
        if (idx == 0) {
            szPic = ["http://vpic.video.qq.com/", uin, "/", lpszVID, "_160_90_3.jpg"].join("");
        } else {
            szPic = ["http://vpic.video.qq.com/", uin, "/", lpszVID, "_", "160_90_", idx, "_1.jpg"].join("");
        }
        return szPic;
    },
    getFullUrlPath: function(path) {
        var h = window.location.host;
        if (h == "sns.video.qq.com" || h == "play.v.qq.com" || h == "page.video.qq.com") {
            h = "v.qq.com";
        }
        return [window.location.protocol, "//", h, txv.common.rootPath, path].join("");
    },
    formatVideoTitle: function(tt) {
        tt = tt.replace(/^(\d{2})(\d{2})(\d{2})([^_]+)(_?\d*)$/ig, "$4 20$1-$2-$3期");
        return tt;
    },
    useHtml5: function() {
        if (txv.common.getUrlParam("usehtml5") == "true") {
            return true;
        }
        return Live.userAgent.isiPad || Live.userAgent.isiPhone || (/\(ipod;/i.test(navigator.userAgent));
    },
    formatNum: function(num) {
        if (!/^(\+|-)?(\d+)(\.\d+)?$/.test(num)) {
            return num;
        }
        var a = RegExp.$1,
        b = RegExp.$2,
        c = RegExp.$3;
        var re = new RegExp("(\\d)(\\d{3})(,|$)");
        while (re.test(b)) b = b.replace(re, "$1,$2$3");
        return a + "" + b + "" + c;
    },
    gotoLoginPage: function(url) {
        if (txv.common.conf.needGoToLoginPage) {
            window.location.href = "http://v.qq.com/pay/login.html?j=" + encodeURIComponent(url || location.href);
        } else {
            txv.login.logout();
        }
        if (window.event) {
            window.event.returnValue = false;
        }
    },
    getClassEn: function(typeid) {
        var de = {
            "1": "movie",
            "2": "tv",
            "3": "cartoon",
            "4": "sports",
            "5": "ent",
            "10": "variety",
            "14": "variety",
            "20": "variety",
            "22": "music",
            "24": "finance",
            "9": "doco",
            "23": "news",
            "100": "education"
        }
        return de[typeid] || "";
    },
    getClassChsName: function(typeid) {
        var de = {
            "1": "电影",
            "2": "电视剧",
            "3": "动漫",
            "4": "体育",
            "5": "娱乐",
            "10": "综艺",
            "14": "综艺",
            "20": "综艺",
            "22": "MV",
            "24": "财经",
            "9": "纪录片",
            "23": "新闻",
            "100": "教育"
        }
        return de[typeid] || "";
    },
    isEventSupported: function(eventName) {
        if ("string" != typeof eventName && eventName.length == 0) {
            return false;
        }
        var isSupported = false;
        var TAGNAMES = {
            'select': 'input',
            'change': 'input',
            'propertychange': 'input',
            'input': 'input',
            'submit': 'form',
            'reset': 'form',
            'error': 'img',
            'load': 'img',
            'abort': 'img'
        };
        var el = document.createElement(TAGNAMES[eventName] || 'div');
        if ( !! el) {
            eventName = "on" + eventName;
            isSupported = (eventName in el);
            if (!isSupported) {
                el.setAttribute(eventName, "return;");
                isSupported = typeof el.getAttribute(eventName) == "function";
            }
        }
        return isSupported;
    },
    formatTimeBySec: function(s, formatStr) {
        if (isNaN(s) || !QZFL.lang.isString(formatStr)) {
            return "";
        }
        var ret = {};
        ret.h = Math.floor(s / 3600);
        ret.hh = ret.h < 10 ? ("0" + ret.h) : ret.h;
        ret.m = Math.floor(s / 60) - ret.h * 60;
        ret.mm = ret.m < 10 ? ("0" + ret.m) : ret.m;
        ret.s = s % 60;
        ret.ss = ret.s < 10 ? ("0" + ret.s) : ret.s;
        return formatStr.replace(/{([smh]+)}/g,
        function(m, key) {
            return typeof(ret[key]) === "undefined" ? m: ret[key];
        });
    }
};
QZFL.object.extend(QZFL.string, {
    filterAngleBrk: function(str) {
        return str.replace(/</g, "&lt;").replace(/>/g, "&gt;");
    },
    filterQuote: function(str) {
        return str.replace(/\x27/g, "&acute;").replace(/\x22/g, "&quot;");
    },
    filterAngAndQt: function(str) {
        str = QZFL.string.filterAngleBrk(str);
        str = QZFL.string.filterQuote(str);
        return str;
    }
});
Live.txv.tips = function(tipTle, tleTxt, cntTxt) {
    this.divName = "ipop";
    this.title = "温馨提示";
    this.showTitle = tleTxt;
    this.showContent = cntTxt;
    this.linkText = "";
    this.linkHref = "";
    this.btnShowText = "";
    this.btnShowHref = "javascript:;";
    this.btnShowClass = "btn_strong"this.btnShowTarget = "_self";
    this.btnCloseText = "关闭";
    this.btnCloseClass = "btn_normal";
    this.iconClass = "";
    this.tipsType = txv.tips.ConstTipsType.Message;
    this.needRemind = 0;
    this.needChoose = 0;
    this.textChoose = "";
    this.width = 0;
    this.height = 0;
    this.top = 0;
    this.left = 0;
    this.display = "block";
    this.padding = "0px";
    this.isShowClose = true;
    this.InitPosition();
    this.floatTimer = 2 * 1000;
    this.t_Closer = '<a href="javascript:;" class="mod_pop_close">关闭</a>';
    this._t_Remind = "";
    this.t_Title = "";
    this._t_Choose = "";
    this._t_closeFunc = 0;
}
Live.txv.tips.ConstTipsType = {
    Warning: 1,
    Message: 2,
    Float: 3
}
Live.txv.tips.prototype = {
    bulitIcon: function() {
        this._Icon = '<div class="icon"><i class="' + this.iconClass + '"></i></div>';
    },
    bulitHeader: function() {
        this.t_Header = ['<div class="mod_pop_hd">'].join('');
        if (QZFL.lang.isString(this.title) && this.title.length > 0) {
            this.t_Header = [this.t_Header, "<h3>", this.title, "</h3>"].join("");
        }
        if (this.isShowClose) {
            this.t_Header += this.t_Closer;
        }
        this.t_Header += "</div>";
    },
    bulitContentTitle: function() {
        this._TitleShow = '<h4 class="title">' + this.showTitle + '</h4>';
    },
    bulitContent: function() {
        this._Link = (this.linkText != "") ? ('<a href="' + this.linkHref + '">' + this.linkText + '</a>') : '';
        var arr = ['<div class="cont"><p>', this.showContent, this._Link, "</p>"];
        if (this.needChoose && !!this._t_Choose) {
            arr.push(this._t_Choose);
        }
        if (this.needRemind && !!this._t_Remind) {
            arr.push(this._t_Remind);
        }
        arr.push('</div>');
        this._t_ContentShow = arr.join("");
    },
    bulitNormalTxt: function() {
        this.bulitContentTitle();
        this.bulitContent();
        this._t_TextShow = ['<div class="text">', this._TitleShow, this._t_ContentShow, '</div>'].join("");
    },
    bulitSimpTxt: function() {
        this._t_TextShow = '<div class="text">' + this.showContent + '</div>';
    },
    bulitBtn: function() {
        this._BtnShow = (this.btnShowText != '') ? ('<a class="' + this.btnShowClass + '" href="' + this.btnShowHref + '" target="' + this.btnShowTarget + '"><span>' + this.btnShowText + '</span></a>') : '';
        this._BtnClose = (this.btnCloseText != '') ? ('<a class="' + this.btnCloseClass + '" href="javascript:;"><span>' + this.btnCloseText + '</span></a>') : '';
        this._t_BtnText = '<div class="mod_pop_ft">' + this._BtnShow + this._BtnClose + '</div>';
    },
    bulitSimpTips: function() {
        this.bulitSimpTxt();
        return ['<div class="mod_hint">', this._Icon, this._t_TextShow, "</div>", this._t_BtnText].join("");
    },
    bulitFloatTips: function() {
        this.bulitSimpTxt();
        return ['<div class="mod_hint">', this._Icon, this._t_TextShow, "</div>"].join("");
    },
    bulitNormalTips: function() {
        this.bulitNormalTxt();
        return [this.t_Header, '<div class="mod_diglog">', this._Icon, this._t_TextShow, "</div>", this._t_BtnText].join("");
    },
    setTipsTitle: function(t) {
        if (typeof(t) === "string") {
            this.title = t;
            this.bulitHeader();
        }
    }
}
Live.txv.tips.prototype.InitPosition = function() {
    var scrhei = document.body.scrollTop;
    var wid = 373;
    var hei = 235;
    if (this.tipsType === txv.tips.ConstTipsType.Float) {
        var w = (QZFL.userAgent.ie && QZFL.userAgent.ie < 8) ? 20 : 15;
        wid = this.showContent.length * w + 160;
        hei = 110;
    }
    if (0 == scrhei) scrhei = document.documentElement.scrollTop;
    var clihei = document.documentElement.clientHeight;
    if (0 == clihei) clihei = document.body.clientHeight;
    this.width = wid;
    this.height = hei;
    this.top = (clihei / 2 + scrhei) - this.height / 2;
    this.left = (document.body.scrollWidth - this.width) / 2;
    this.position = "absolute";
    this.display = "block";
    this.padding = 0;
}
Live.txv.tips.prototype.onBtnOk = function() {}
Live.txv.tips.prototype.onBtnClose = function() {}
Live.txv.tips.prototype.SetType = function(type) {
    this.tipsType = type;
    switch (type) {
    case Live.txv.tips.ConstTipsType.Warning:
        this.iconClass = 'icon_hint_warn';
        break;
    case Live.txv.tips.ConstTipsType.Message:
    case Live.txv.tips.ConstTipsType.Float:
    default:
        this.iconClass = 'icon_hint_succeed';
        break;
    }
    this.bulitIcon();
}
Live.txv.tips.prototype.SetBtn = function(showBtnTxt, closeBtnTxt, btnShowHref, btnShowTarget) {
    this.btnShowText = showBtnTxt;
    if ( !! btnShowHref && !!btnShowTarget) {
        this.btnShowHref = btnShowHref;
        this.btnShowTarget = btnShowTarget;
    }
    if (closeBtnTxt != "") {
        this.btnCloseText = closeBtnTxt;
    }
    this.bulitBtn();
}
Live.txv.tips.prototype.SetLink = function(txt, href) {
    this.linkText = txt;
    this.linkHref = href;
    this.bulitContent();
}
Live.txv.tips.prototype.SetPostion = function(x, y) {
    this.top = y;
    this.left = x;
}
Live.txv.tips.prototype.AddRemind = function() {
    this.needRemind = 1;
    this._t_Remind = '<p class="input_middle"><input type="checkbox" name="input_remind" value="1" id="input_remind" /><label for="input_remind">不再提醒</label></p>';
    this.bulitContent();
}
Live.txv.tips.prototype.AddChoose = function(txt) {
    this.needChoose = 1;
    this._t_Choose = '<p class="input_middle"><input type="checkbox" name="input_choose" value="1" id="input_choose" /><label for="input_choose">' + txt + '</label></p>';
    this.bulitContent();
}
Live.txv.tips.prototype.SetHide = function() {
    $e("#" + this.divName).hide();
    txv.login.hideMask();
}
Live.txv.tips.prototype.HideClose = function() {
    this.isShowClose = false;
}
Live.txv.tips.prototype._init = function() {
    this.bulitBtn();
    this.bulitHeader();
    if (this.tipsType === txv.tips.ConstTipsType.Float) {
        this.tipsHTML = this.bulitFloatTips();
    } else {
        this.tipsHTML = this.bulitNormalTips();
    }
}
Live.txv.tips.prototype.FillPage = function() {
    if (!$(this.divName)) {
        $e("body").create("div", {
            "id": this.divName,
            "class": "mod_pop"
        });
    }
    if (!QZFL.lang.isString(this.tipsHTML) || this.tipsHTML.length <= 0) {
        this._init();
    }
    var divObj = $e("#" + this.divName);
    divObj.hide();
    divObj.html(this.tipsHTML);
    divObj.addClass("mod_pop");
    this.InitPosition();
    divObj.css("width", this.width + "px");
    divObj.css("height", "auto");
    divObj.css("top", this.top + "px");
    divObj.css("left", this.left + "px");
    divObj.css("position", this.position);
    divObj.css("display", this.display);
    divObj.css("padding", this.padding);
    divObj.show();
    if (typeof Live.txv.tips.onShowTips == "function") {
        Live.txv.tips.onShowTips();
    }
    txv.login.showMask(this.divName, this.width, parseInt(divObj.css("height")));
    var $me = this;
    function hideTips() {
        divObj.hide();
        txv.login.hideMask();
        if (typeof Live.txv.tips.onHideTips == "function") {
            Live.txv.tips.onHideTips();
        }
    }
    divObj.find(".mod_pop_close").bind('click',
    function() {
        hideTips();
        if (typeof($me.onBtnClose) == "function") {
            $me.onBtnClose();
        }
        try {
            if ($e('#input_remind').elements[0].checked) {
                QZFL.cookie.set('ql_alert', 1, "v.qq.com", "/", 24 * 365 * 2);
            }
        } catch(e) {}
    });
    if (this.btnShowText != "") {
        divObj.find("." + this.btnShowClass).bind('click',
        function() {
            hideTips();
            if (typeof($me.onBtnOk) == "function") {
                $me.onBtnOk();
            }
        });
    }
    divObj.find("." + this.btnCloseClass).bind('click',
    function() {
        hideTips();
        if (typeof($me.onBtnClose) == "function") {
            $me.onBtnClose();
        }
    });
    if (this.tipsType == txv.tips.ConstTipsType.Float) {
        var timer = isNaN(this.floatTimer) ? 1000 : this.floatTimer;
        setTimeout(function() {
            hideTips();
        },
        timer);
    }
}
Live.txv.tips.onShowTipsEventList = [];
Live.txv.tips.onHideTipsEventList = [];
Live.txv.tips.addOnShowTipsCallBack = function(fn) {
    if (typeof fn == "function") {
        Live.txv.tips.onShowTipsEventList.push(fn);
    }
}
Live.txv.tips.addOnHideTipsCallBack = function(fn) {
    if (typeof fn == "function") {
        Live.txv.tips.onHideTipsEventList.push(fn);
    }
}
Live.txv.tips.onShowTips = function() {
    if (QZFL.lang.isArray(Live.txv.tips.onShowTipsEventList)) {
        for (var idx = 0,
        len = Live.txv.tips.onShowTipsEventList.length; idx < len; idx++) {
            if (typeof Live.txv.tips.onShowTipsEventList[idx] == "function") {
                Live.txv.tips.onShowTipsEventList[idx]();
            }
        }
    }
}
Live.txv.tips.onHideTips = function() {
    if (QZFL.lang.isArray(Live.txv.tips.onHideTipsEventList)) {
        for (var idx = 0,
        len = Live.txv.tips.onHideTipsEventList.length; idx < len; idx++) {
            if (typeof Live.txv.tips.onHideTipsEventList[idx] == "function") {
                Live.txv.tips.onHideTipsEventList[idx]();
            }
        }
    }
}
Live.txv.tips.ShowTips = function(divId, title, msg1, msg2, btn1, btn2, type, callback) {
    divId = divId || "";
    title = "温馨提示";
    msg1 = msg1 || "";
    msg2 = msg2 || "";
    btn1 = btn1 || "";
    btn2 = btn2 || "";
    type = type || "";
    if (divId == "") {
        return;
    }
    if (msg1 == "") {
        return;
    }
    if (type == "") {
        type = txv.tips.ConstTipsType.Warning;
    }
    var tip = new txv.tips(title, msg1, msg2);
    tip.SetBtn(btn1, btn2);
    tip.SetType(type);
    tip.onBtnOk = function() {
        tip.SetHide();
        if (typeof(callback) == "function") {
            callback();
        }
    }
    tip.FillPage(divId);
}
Live.txv.tips.ShowFloatTips = function(msg, time) {
    if (QZFL.lang.isString(msg) && msg.length > 0) {
        var tips = new txv.tips();
        tips.showContent = msg;
        if (!isNaN(time)) {
            tips.floatTimer = time * 1000;
        }
        tips.SetType(txv.tips.ConstTipsType.Float);
        tips.FillPage();
    }
}
Live.txv.tips.ShowSimpMsgTips = function(title, msg, btnTxt, cb) {
    if (QZFL.lang.isString(msg) && QZFL.lang.isString(title)) {
        var tips = new txv.tips();
        tips.showTitle = title;
        tips.showContent = msg;
        tips.btnCloseClass = "btn_strong";
        if ( !! btnTxt) {
            tips.btnCloseText = btnTxt;
            cb = typeof(cb) === "function" ? cb: QZFL.emptyFn;
            tips.onBtnClose = cb;
        }
        tips.SetType(txv.tips.ConstTipsType.Message);
        tips.FillPage();
    }
}
Live.txv.tips.ShowSimpWarningTips = function(title, msg, btnTxt, cb) {
    if (QZFL.lang.isString(msg) && QZFL.lang.isString(title)) {
        var tips = new txv.tips();
        tips.showTitle = title;
        tips.showContent = msg;
        tips.btnCloseClass = "btn_strong";
        if ( !! btnTxt) {
            tips.btnCloseText = btnTxt;
            cb = typeof(cb) === "function" ? cb: QZFL.emptyFn;
            tips.onBtnClose = cb;
        }
        tips.SetType(txv.tips.ConstTipsType.Warning);
        tips.FillPage();
    }
}
Live.txv.book = {
    constvar: {
        tipstitle: {
            book: '成功订阅当前节目！',
            cancel: '取消订阅成功！',
            error: '订阅失败，请稍后再试。',
            login: '登录超时，请重新登录',
            bookerror: '订阅失败，请稍后再试。',
            cancelerror: '取消订阅失败，请稍后再试。'
        },
        tipscontent: {
            book: '在您订阅的节目开始前5分钟，我们会通过<br />QQ消息提醒您观看,<br />进<a href="http://v.qq.com/mytv/booking.html" target="_blank">我的订阅</a>管理订阅列表',
            cancel: '',
            error: '请稍后再试'
        },
        bookbtntext: {
            alt: '订阅后，系统会在节目更新后通过QQ消息提醒您观看。',
            book: '订阅节目更新信息',
            cancel: '取消通知'
        },
        bookbtntextspan: {
            alt: '订阅后，系统会在节目更新后通过QQ消息提醒您观看。',
            book: '预订',
            cancel: '取消预订'
        }
    },
    config: {
        cgi: "http://sns.video.qq.com/fcgi-bin/liveportal/nbook?otype=json&f=1&",
        id: '',
        tid: '',
        type: 0,
        op: 2,
        bookbtn: null,
        keyprefix: '',
        logincallback: null,
        btnspan: false
    },
    ids: null,
    items: null,
    TipBoxShow: function(title, msg, iconType) {
        var tips = new txv.tips("Message", title, msg);
        if (iconType == 1) {
            tips.SetType(txv.tips.ConstTipsType.Message);
        } else {
            tips.SetType(txv.tips.ConstTipsType.Warning);
        }
        tips.FillPage();
    },
    TipBoxShowTiny: function(msg) {
        var g_tip = new txv.tips("", "", msg);
        g_tip.SetType(txv.tips.ConstTipsType.Float);
        g_tip.FillPage();
    },
    TipBoxShowConfirm: function(idx) {
        var self = this;
        var title = "确定取消订阅？";
        var msg = "取消订阅后您将不再收到节目开始的提醒<br />进<a href=\"http://v.qq.com/mytv/booking.html\" target=\"_blank\">我的订阅</a>管理订阅列表";
        var g_tip = null;
        g_tip = new txv.tips("Message", title, msg);
        g_tip.SetType(txv.tips.ConstTipsType.Warning);
        g_tip.SetBtn("确定", "取消");
        g_tip.onBtnOk = function() {
            self._cancel(idx);
        }
        g_tip.FillPage();
    },
    init: function(_config) {
        var self = this;
        self.items = [];
        self.ids = {};
        Live.object.extend(self.config, _config);
        txv.login.config.success = function() {
            self.isBooked();
            if (typeof self.config.logincallback == "function") {
                self.config.logincallback();
            }
        };
        if (!self.config.bookbtn) {
            return;
        }
        for (var i = 0; i < self.config.bookbtn.size(); ++i) {
            var $btn = self.config.bookbtn.get(i);
            var _bookid = $btn.getAttr("bookid") || self.config.id;
            var _tid = $btn.getAttr("tid") || self.config.tid;
            self.ids[_bookid] = i;
            self.items.push({
                "stat": 2,
                "id": _bookid,
                "tid": _tid,
                "btn": $btn
            });
        }
        self.isBooked();
        self.config.bookbtn.each(function(el, i) {
            var $el = $e(el);
            $el.bind("click",
            function() {
                switch (self.items[i].stat) {
                case 2:
                    self.book(i);
                    break;
                case 3:
                    self.cancel(i);
                    break;
                }
            });
        });
    },
    book: function(idx) {
        var self = this;
        var uin = txv.login.getUin();
        if (uin <= 10000) {
            txv.login.openLogin();
            return false;
        }
        var url = self.config.cgi + "uin=" + uin + "&op=2&id=" + self.items[idx].id + "&t=" + self.config.type;
        if (self.config.type == 2) {
            url += "&tid=" + self.items[idx].tid;
        }
        $j.getJsonp(url,
        function(json) {
            if (!json) return;
            self.onBook(json, idx);
        });
    },
    onBook: function(json, idx) {
        var self = this;
        if (json.suc == -1) {
            this.TipBoxShow(self.constvar.tipstitle.login, "", 0);
            txv.login.logout();
            return;
        }
        if (json.suc != 0) {
            this.TipBoxShow(self.constvar.tipstitle.error, self.constvar.tipscontent.error, 0);
            return;
        }
        self.items[idx].stat = 3;
        if (self.config.btnspan == true) {
            self.items[idx].btn.find("span").html(self.constvar.bookbtntextspan.cancel);
        } else {
            self.items[idx].btn.text(self.constvar.bookbtntext.cancel);
        }
        if ( !! $e("#zt_nbook")) {
            if ($e("#zt_nbook").hasClass("show_btn_2")) {
                $e("#zt_nbook").removeClass("show_btn_2");
                $e("#zt_nbook").addClass("show_btn_1");
            }
            if ($e("._book").hasClass("btn_2")) {
                $e("._book").removeClass("btn_2");
                $e("._book").addClass("btn_1");
            }
            if ($e("._book").hasClass("bt_notice")) {
                $e("._book").removeClass("bt_notice");
                $e("._book").addClass("bt_cancel");
            }
        }
        self.items[idx].btn.setAttr('title', '');
        if (self.items[idx].btn.hasClass("c_yd")) {
            self.items[idx].btn.removeClass("c_yd");
            self.items[idx].btn.addClass("c_ca");
        }
        this.TipBoxShow(self.constvar.tipstitle.book, self.constvar.tipscontent.book, 1);
    },
    cancel: function(idx) {
        var uin = txv.login.getUin();
        if (uin <= 10000) {
            txv.login.openLogin();
            return false;
        }
        this.TipBoxShowConfirm(idx);
        return;
    },
    _cancel: function(idx) {
        var self = this;
        var url = self.config.cgi + "uin=" + txv.login.getUin() + "&op=3&id=" + self.items[idx].id + "&t=" + self.config.type;
        if (self.config.type == 2) {
            url += "&tid=" + self.items[idx].tid;
        }
        $j.getJsonp(url,
        function(json) {
            if (!json) return;
            self.onCancel(json, idx);
        });
    },
    onCancel: function(json, idx) {
        var self = this;
        if (json.suc == -1) {
            this.TipBoxShow(self.constvar.tipstitle.login, "", 0);
            txv.login.logout();
            return;
        }
        if (json.suc != 0) {
            this.TipBoxShow(self.constvar.tipstitle.error, self.constvar.tipscontent.error, 0);
            return;
        }
        self.items[idx].stat = 2;
        if (self.config.btnspan == true) {
            self.items[idx].btn.find("span").html(self.constvar.bookbtntextspan.book);
        } else {
            self.items[idx].btn.text(self.constvar.bookbtntext.book);
        }
        if ( !! $e("#zt_nbook")) {
            if ($e("#zt_nbook").hasClass("show_btn_1")) {
                $e("#zt_nbook").removeClass("show_btn_1");
                $e("#zt_nbook").addClass("show_btn_2");
            }
            if ($e("._book").hasClass("btn_1")) {
                $e("._book").removeClass("btn_1");
                $e("._book").addClass("btn_2");
            }
            if ($e("._book").hasClass("bt_cancel")) {
                $e("._book").removeClass("bt_cancel");
                $e("._book").addClass("bt_notice");
            }
        }
        self.items[idx].btn.setAttr('title', self.constvar.bookbtntext.alt);
        if (self.items[idx].btn.hasClass("c_ca")) {
            self.items[idx].btn.removeClass("c_ca");
            self.items[idx].btn.addClass("c_yd");
        }
        self.TipBoxShowTiny("取消订阅成功！");
    },
    isBooked: function() {
        var self = this;
        var uin = txv.login.getUin();
        if (uin <= 10000) {
            return false;
        }
        var url = self.config.cgi + "uin=" + uin + "&op=0&t=" + self.config.type;
        $j.getJsonp(url,
        function(json) {
            if (!json) return;
            self.onIsBooked(json);
        });
    },
    onIsBooked: function(json) {
        var self = this;
        if (json.suc == -1) {
            txv.login.logout();
            return;
        }
        if (json.suc != 0 || !isArray(json.pros)) {
            return;
        }
        for (var i = 0; i < self.items.length; ++i) {
            self.items[i].stat = 2;
            if (self.config.btnspan == true) {
                self.items[i].btn.find("span").html(self.constvar.bookbtntextspan.book);
            } else {
                self.items[i].btn.text(self.constvar.bookbtntext.book);
            }
            if ( !! $e("#zt_nbook")) {
                if ($e("#zt_nbook").hasClass("show_btn_1")) {
                    $e("#zt_nbook").removeClass("show_btn_1");
                    $e("#zt_nbook").addClass("show_btn_2");
                }
                if ($e("._book").hasClass("btn_1")) {
                    $e("._book").removeClass("btn_1");
                    $e("._book").addClass("btn_2");
                }
                if ($e("._book").hasClass("bt_cancel")) {
                    $e("._book").removeClass("bt_cancel");
                    $e("._book").addClass("bt_notice");
                }
            }
            self.items[i].btn.setAttr('title', self.constvar.bookbtntext.alt);
            if (self.items[i].btn.hasClass("c_ca")) {
                self.items[i].btn.removeClass("c_ca");
                self.items[i].btn.addClass("c_yd");
            }
        }
        for (var i = 0; i < json.pros.length; ++i) {
            if (typeof self.ids[json.pros[i].id] == 'number') {
                var _idx = self.ids[json.pros[i].id];
                self.items[_idx].stat = 3;
                if (self.config.btnspan == true) {
                    self.items[_idx].btn.find("span").html(self.constvar.bookbtntextspan.cancel);
                } else {
                    self.items[_idx].btn.text(self.constvar.bookbtntext.cancel);
                }
                if ( !! $e("#zt_nbook")) {
                    if ($e("#zt_nbook").hasClass("show_btn_2")) {
                        $e("#zt_nbook").removeClass("show_btn_2");
                        $e("#zt_nbook").addClass("show_btn_1");
                    }
                    if ($e("._book").hasClass("btn_2")) {
                        $e("._book").removeClass("btn_2");
                        $e("._book").addClass("btn_1");
                    }
                    if ($e("._book").hasClass("bt_notice")) {
                        $e("._book").removeClass("bt_notice");
                        $e("._book").addClass("bt_cancel");
                    }
                }
                self.items[_idx].btn.setAttr('title', '');
                if (self.items[_idx].btn.hasClass("c_yd")) {
                    self.items[_idx].btn.removeClass("c_yd");
                    self.items[_idx].btn.addClass("c_ca");
                }
            }
        }
    }
}
Live.txv.history = {
    option: {
        coverid: '',
        tit: null,
        lnk: null,
        vid: ""
    },
    mod_id: "history_pop",
    reportImg: null,
    hisList: null,
    localList: {},
    localUserStorgeKeyArr: null,
    uinStorageKey: "ten_video_history_uin_storage_key",
    key: "ten_video_history",
    template: "<li key='{key}'><span class='mod_video_name no_time'><a href='{lnk}' _hot='nav.history.title' title='{tit}'>{tit}</a></span><a href='{lnk}' _hot='nav.history.see'>{ltxt}</a><button _hot='nav.history.del' type='button' _key='{key}' title='删除' _idx={idx}>X</button></li>",
    rmAllTemp: "<p class='mod_clear_play'><a href='javascript:;' onclick='txv.history.removeAll();'><b class='mod_icons'></b>清空播放记录</a></p>",
    iframeTemp: "<iframe scrolling=\"no\" frameborder=\"0\"></iframe>",
    timeLongLimit: 60 * 10,
    reportTimer: 0,
    reportToServerTimeLimit: 30,
    setCurVideo: function(opt) {
        for (var k in opt) {
            txv.history.option[k] = opt[k];
        }
    },
    onShowHistory: QZFL.emptyFn,
    onHideHistory: QZFL.emptyFn,
    timeOrderLocalList: [],
    timeOrderKeyList: [],
    hadSort: false,
    localAddLock: false,
    hadbatchReport: false,
    playPageFlag: false,
    init: function(playPageFlag) {
        setTimeout(function() {
            txv.history.sortLocalListByTime();
        },
        0);
        var area = $e("#history");
        var pop = $e("#" + txv.history.mod_id);
        var container = $e("#history_list").elements.length ? $e("#history_list") : pop;
        var menu = new Live.FloatMenu({
            menu: pop,
            area: area.find("h6 a"),
            areaOutdelay: 100,
            onShow: function(obj) {
                area.addClass("open");
                if (container.html().length == 0) {
                    container.html(" 正在努力获取数据..");
                    txv.history.showHistory();
                    txv.common.btnTj("history");
                }
                if (typeof txv.history.onShowHistory == "function") {
                    txv.history.onShowHistory();
                }
            },
            onHide: function(obj) {
                area.removeClass("open");
                if (typeof txv.history.onHideHistory == "function") {
                    txv.history.onHideHistory();
                }
            }
        });
        this.bindRm();
        txv.login.addLoginCallback(function() {
            txv.history.batchReportToServer(5,
            function() {
                txv.history.showHistory(5);
            });
        });
        txv.login.addLogoutCallback(function() {
            txv.history.showLocalHistory(5);
        });
        txv.history.getLocalList();
        if (!playPageFlag) {
            txv.history.batchReportToServer(5);
        } else {
            txv.history.playPageFlag = !!playPageFlag;
        }
    },
    getStorageKey: function(vid, coverid) {
        return QZFL.string.trim([coverid, vid].join("_"));
    },
    bindRm: function() {
        $e(document).undelegate("button[_hot=nav.history.del]", "click");
        $e(document).delegate("button[_hot=nav.history.del]", "click",
        function(evt) {
            txv.history.rm(this.getAttribute("_key"), this.getAttribute("_idx") || 0);
            evt.returnValue = false;
        });
    },
    getHistory: function(_conf) {
        var conf = {
            cb: Live.emptyFn,
            onError: Live.emptyFn,
            cur: 0,
            pn: 5,
            isSimp: true
        };
        Live.object.extend(conf, _conf);
        var isSimp = typeof(conf.isSimp) == "boolean" ? conf.isSimp: true;
        var retObj = new Live.RetCode(100031);
        if (isSimp) {
            $j.ajax({
                url: txv.path.queryHistoryRecordCgi,
                dataType: "jsonp",
                data: {
                    t: 1,
                    simp: 1,
                    otype: "json",
                    cur: conf.cur,
                    pn: conf.pn,
                    "_": Math.ceil(Math.random() * 1000)
                },
                CSRF: true,
                beforeSend: function() {
                    retObj.begin();
                },
                success: function(json) {
                    if (QZFL.object.getType(json) === "object" && QZFL.object.getType(json.result) === "object") {
                        if (json.result.code == 0) {
                            conf.cb(json);
                            retObj.reprotSuc();
                        } else if (json.result.code == -11) {
                            retObj.reportErr( - 11);
                            txv.login.openLogin({
                                success: function() {
                                    txv.history.getHistory(conf);
                                }
                            });
                        } else {
                            retObj.reportErr(json.result.code);
                        }
                    } else {
                        retObj.reportErr( - 1);
                    }
                },
                error: function() {
                    if (typeof conf.onError == "function") {
                        conf.onError();
                    }
                    retObj.reportErr( - 1);
                }
            });
        } else {
            $j.ajax({
                url: txv.path.queryHistoryRecordCgi,
                dataType: "jsonp",
                data: {
                    t: 1,
                    otype: "json",
                    cur: conf.cur,
                    "_": Math.ceil(Math.random() * 1000),
                    pn: conf.pn
                },
                CSRF: true,
                beforeSend: function() {
                    retObj.begin();
                },
                success: function(json) {
                    if (QZFL.object.getType(json) === "object" && QZFL.object.getType(json.result) === "object") {
                        if (json.result.code == 0) {
                            conf.cb(json);
                            retObj.reprotSuc();
                        } else if (json.result.code == -11) {
                            retObj.reportErr( - 11);
                            txv.common.gotoLoginPage();
                        } else {
                            retObj.reportErr(json.result.code);
                        }
                    } else {
                        retObj.reportErr( - 1);
                    }
                },
                error: function() {
                    if (typeof conf.onError == "function") {
                        conf.onError();
                    }
                    retObj.reportErr( - 1);
                }
            });
        }
    },
    getLocalUserStorgeKeyArr: function(cb) {
        cb = typeof cb == "function" ? cb: QZFL.emptyFn;
        if (QZFL.lang.isArray(txv.history.localUserStorgeKeyArr)) {
            cb(txv.history.localUserStorgeKeyArr);
        } else {
            QZFL.Storage.get(txv.history.uinStorageKey,
            function(val) {
                txv.history.localUserStorgeKeyArr = txv.history.parseLocalRecord(val);
                var tmpArr = [];
                var remark = {};
                var arr = txv.history.localUserStorgeKeyArr;
                var hasDefault = false;
                for (var idx = 0,
                iLen = arr.length; idx < iLen; idx++) {
                    if (QZFL.lang.isString(arr[idx])) {
                        var opt = arr[idx].split(",");
                        if (typeof(remark[opt[0]]) === "undefined") {
                            remark[opt[0]] = true;
                            tmpArr.push(arr[idx]);
                        }
                        if (opt[0] === txv.history.key) {
                            hasDefault = true;
                        }
                    }
                }
                if (hasDefault == false) {
                    var curTime = txv.history.getCurTimeStmp();
                    tmpArr.push([txv.history.key, curTime, curTime].join(","));
                }
                QZFL.Storage.set(txv.history.uinStorageKey, tmpArr.join("|"));
                txv.history.localUserStorgeKeyArr = tmpArr;
                cb(txv.history.localUserStorgeKeyArr);
            });
        }
    },
    getLocalList: function(key, cb) {
        if (typeof(key) !== "string" || key.length === 0) {
            return false;
        }
        cb = typeof cb == "function" ? cb: QZFL.emptyFn;
        if (QZFL.lang.isArray(txv.history.localList[key])) {
            cb(txv.history.localList[key]);
        } else {
            QZFL.Storage.get(key,
            function(val) {
                txv.history.localList[key] = txv.history.parseLocalRecord(val);
                cb(txv.history.localList[key]);
            });
        }
    },
    sortLocalListByTime: function(cb) {
        if (txv.login.isLogin() || txv.history.hadSort) {
            return;
        }
        txv.history.hadSort = true;
        cb = typeof(cb) === "function" ? cb: Live.emptyFn;
        txv.history.getLocalUserStorgeKeyArr(function(arr) {
            if (!QZFL.lang.isArray(arr)) {
                return;
            }
            if (arr.length === 0) {
                var curTime = txv.history.getCurTimeStmp();
                arr.push([txv.history.key, curTime, curTime].join(","));
                QZFL.Storage.set(txv.history.uinStorageKey, arr.join("|"));
            }
            for (var idx = 0,
            len = arr.length; idx < len; idx++) {
                var str = arr[idx];
                if (typeof(str) !== "string") {
                    continue;
                }
                var userinforArr = str.split(",");
                var storageKey = userinforArr[0];
                txv.history.getLocalList(storageKey,
                function(arr) {
                    if (!QZFL.lang.isArray(txv.history.timeOrderLocalList)) {
                        txv.history.timeOrderLocalList = [];
                    }
                    if (!QZFL.lang.isArray(arr)) {
                        return;
                    }
                    if (txv.history.timeOrderLocalList.length === 0) {
                        txv.history.timeOrderLocalList = txv.history.timeOrderLocalList.concat(arr);
                        var keyArr = [];
                        QZFL.object.each(arr,
                        function(key, val) {
                            keyArr.push(storageKey);
                        });
                        txv.history.timeOrderKeyList = txv.history.timeOrderKeyList.concat(keyArr);
                    } else {
                        if (typeof(txv.history.timeOrderLocalList[0]) === "string" && typeof(arr[arr.length - 1]) === "string") {
                            var firstArr = txv.history.timeOrderLocalList[0].split(",");
                            var lastArr = arr[arr.length - 1].split(",");
                            if (firstArr[2] <= lastArr[2]) {
                                txv.history.timeOrderLocalList = arr.concat(txv.history.timeOrderLocalList);
                                var keyArr = [];
                                QZFL.object.each(arr,
                                function(key, val) {
                                    keyArr.push(storageKey);
                                });
                                txv.history.timeOrderKeyList = keyArr.concat(txv.history.timeOrderKeyList);
                            } else {
                                if (typeof(txv.history.timeOrderLocalList[txv.history.timeOrderLocalList.length - 1]) === "string" && typeof(arr[0]) === "string") {
                                    firstArr = arr[0].split(",");
                                    lastArr = txv.history.timeOrderLocalList[txv.history.timeOrderLocalList.length - 1].split(",");
                                    if (firstArr[2] <= lastArr[2]) {
                                        txv.history.timeOrderLocalList = txv.history.timeOrderLocalList.concat(arr);
                                        var keyArr = [];
                                        QZFL.object.each(arr,
                                        function(key, val) {
                                            keyArr.push(storageKey);
                                        });
                                        txv.history.timeOrderKeyList = txv.history.timeOrderKeyList.concat(keyArr);
                                    } else {
                                        var curIdx = 0,
                                        tmpAtt, iLen = arr.length;
                                        for (var i = 0; i < iLen; i++) {
                                            if (typeof(arr[i]) !== "string") {
                                                continue;
                                            }
                                            var t = arr[i].split(",");
                                            for (; curIdx < txv.history.timeOrderLocalList.length; curIdx++) {
                                                var n = txv.history.timeOrderLocalList[curIdx];
                                                if (typeof(n) !== "string") {
                                                    continue;
                                                }
                                                var m = n.split(",");
                                                if (m[2] < t[2]) {
                                                    tmpAtt = txv.history.timeOrderLocalList.splice(curIdx);
                                                    txv.history.timeOrderLocalList.push(arr[i]);
                                                    txv.history.timeOrderLocalList = txv.history.timeOrderLocalList.concat(tmpAtt);
                                                    tmpAtt = txv.history.timeOrderKeyList.splice(curIdx);
                                                    txv.history.timeOrderKeyList.push(storageKey);
                                                    txv.history.timeOrderKeyList = txv.history.timeOrderKeyList.concat(tmpAtt);
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                });
            }
        });
        cb();
    },
    showLocalHistory: function(count) {
        count = count || 5;
        if (!txv.history.hadSort) {
            txv.history.sortLocalListByTime(function() {
                txv.history.showHistory();
            });
            return;
        }
        txv.log("on showHistory");
        var storagekey = txv.history.makeUserStorageKey();
        var his = txv.history.timeOrderLocalList;
        var len = his.length;
        var readyShowList = [];
        if (len == 0) {
            txv.history.showEmpty();
            return;
        }
        for (var i = 0; i < len; i++) {
            if (typeof(his[i]) != "string") {
                continue;
            }
            var opt = his[i].split(',');
            if (opt.length < 4) {
                continue;
            }
            var hasSame = false;
            for (var idx = 0,
            iLen = readyShowList.length; idx < iLen; idx++) {
                if (typeof(readyShowList[idx]) === "string" && readyShowList[idx].indexOf(opt[0]) !== -1) {
                    hasSame = true;
                    break;
                }
            }
            if (hasSame) {
                txv.log("already had same keyid");
                continue;
            }
            var time = opt[3] * 1;
            var ltxt = "继续观看";
            if (time == -2) {
                ltxt = "重新观看";
            }
            var lnk = txv.history.getPlayUrl(opt[0]);
            var tit = QZFL.string.filterAngAndQt(opt[1]);
            time = txv.history.getTipsByTime(time);
            readyShowList.push(txv.history.template.replace(/{key}/g, opt[0]).replace(/{tit}/g, tit).replace(/{lnk}/g, lnk).replace(/{ltxt}/g, ltxt).replace(/{time}/g, time).replace(/{idx}/g, i));
            if (readyShowList.length === count) {
                break;
            }
        }
        var $his = $e("#history_list");
        if ($his.size() > 0) {
            $his.html(readyShowList.join(''));
        } else {
            var $mod = $e("#" + txv.history.mod_id);
            if ($mod.attr("useIframe") == 1) {
                $mod.html(["<ul id=\"history_list\">", readyShowList.join(''), "</ul>", txv.history.rmAllTemp, txv.history.iframeTemp].join(""));
            } else {
                $mod.html(["<ul id=\"history_list\">", readyShowList.join(''), "</ul>", txv.history.rmAllTemp].join(""));
            }
        }
    },
    getTipsByTime: function(time) {
        time = parseInt(time);
        if (time == -2) {
            return "观看完毕";
        } else if (time == -1 || time < 60) {
            return "观看不到1分钟";
        } else if (time < 0) {
            return "剩下不到1分钟";
        } else {
            if (time > 3600) {
                var h = Math.floor(time / 3600);
                time = time % 3600;
                return "观看至" + h + "小时 " + Math.ceil(time / 60) + "分钟";
            } else {
                return "观看至" + Math.ceil(time / 60) + "分钟";
            }
        }
    },
    showHistory: function(count) {
        count = count || 5;
        if (!txv.login.isLogin()) {
            txv.history.showLocalHistory(5);
            return;
        }
        if (txv.history.hisList != null) {
            txv.history.renderContent(txv.history.hisList);
            return;
        }
        txv.history.getHistory({
            cb: txv.history.renderContent,
            cur: 1,
            pn: count,
            isSimp: true,
            onError: function() {
                $e("#" + txv.history.mod_id).html("获取数据失败，请尝试刷新页面");
            }
        });
    },
    renderContent: function(json) {
        txv.history.hisList = json;
        if (!json || json.tot == 0 || !json.list) {
            txv.history.showEmpty();
            return;
        }
        var strArr = [];
        var tmpStr = "";
        var len = json.list.length
        for (var i = 0; i < len; i++) {
            if (!json.list[i].playUrl) {
                json.list[i].playUrl = txv.history.getPlayUrl(json.list[i]);
            }
            if (!json.list[i].tips) {
                json.list[i].tips = txv.history.getTipsByTime(json.list[i].time);
            }
            if (!json.list[i].ltxt) {
                json.list[i].ltxt = json.list[i].time == -2 ? "重新观看": "继续观看";
            }
            if (!json.list[i].tit) {
                json.list[i].tit = QZFL.string.filterAngAndQt(txv.history.getTitle(json.list[i]));
            }
            tmpStr = txv.history.template.replace(/{tit}/g, json.list[i].tit);
            tmpStr = tmpStr.replace(/{lnk}/g, json.list[i].playUrl);
            tmpStr = tmpStr.replace(/{time}/g, json.list[i].tips);
            tmpStr = tmpStr.replace(/{key}/g, json.list[i].keyid);
            tmpStr = tmpStr.replace(/{ltxt}/g, json.list[i].ltxt).replace(/{idx}/g, i);
            strArr.push(tmpStr);
        }
        var $container = $e("#" + txv.history.mod_id);
        if ($container.attr("useIframe") == "1") {
            $container.html(["<ul>", strArr.join(""), "</ul>", txv.history.rmAllTemp, txv.history.iframeTemp].join(""));
        } else {
            $container.html(["<ul>", strArr.join(""), "</ul>", txv.history.rmAllTemp].join(""));
        }
    },
    getPlayUrl: function(json) {
        var url = "";
        if (typeof(json) === "string") {
            var key = json,
            keyArr = key.split("_"),
            cid = keyArr[0],
            vid = keyArr[1];
            if (!isNaN(keyArr[2])) {
                vid += "_" + keyArr[2];
            }
            if (typeof(cid) === "string" && cid.length > 0) {
                url = txv.common.getStaticPlayUrl(cid, vid);
            } else if (typeof(vid) === "string" && vid.length > 0) {
                url = txv.common.getVideoPlayUrl(vid);
            }
        } else if (QZFL.object.getType(json) === "object") {
            var keyArr = json.keyid.split("_");
            var url = "";
            var time = json.time < 0 ? json.time * -1 : json.time;
            if (keyArr.length == 3) {
                keyArr[1] = keyArr[1] + "_" + keyArr[2];
            }
            if (json.ctypeid == 7) {
                url = txv.common.getBokePlayUrl(keyArr[1]);
            } else if (keyArr[0].length > 0) {
                url = txv.common.getPlayUrl(keyArr[0], keyArr[1]);
            } else {
                url = txv.common.getVideoPlayUrl(keyArr[1]);
            }
            if (time > 0) {
                if (url.indexOf("?") === -1) {
                    url += "?start=" + time;
                } else {
                    url += "&start=" + time;
                }
            }
        }
        return txv.common.getFullUrlPath(url);
    },
    getTitle: function(json) {
        if (!json) {
            return "";
        }
        json.title = json.title || "";
        json.vtit = json.vtit || "";
        if (json.ctypeid == 2 || json.ctypeid == 3) {
            var arr = json.vtit.match(/^([^_]+)_(\d+)$/);
            if ( !! arr && arr.length == 3) {
                if (json.vtit.indexOf("预告片") == -1) {
                    return [arr[1], " 第", arr[2], "集"].join("");
                } else {
                    return [json.title, " 第", arr[2], "集", arr[1]].join("");
                }
            } else {
                arr = json.vtit.match(/^([^_]+)_(\d+)_(\d+)$/);
                if ( !! arr && arr.length == 4) {
                    return [arr[1], " 第", arr[2], "集"].join("");
                }
            }
            return json.title + " " + json.vtit;
        } else if (json.ctypeid == 1 || json.ctypeid == 98) {
            var reg = new RegExp("^" + json.title + "_\\d+");
            if (reg.test(json.vtit)) {
                return json.title || json.vtit;
            } else {
                return json.vtit;
            }
        } else {
            return txv.common.formatVideoTitle(json.vtit);
        }
    },
    add: function(flag, time, total) {++txv.history.reportTimer;
        setTimeout(function() {
            txv.history.addToLocal(time, total, flag);
        },
        0);
        if (!txv.login.isLogin()) {
            txv.log("not login!!");
            return;
        }
        if (flag == -3 && txv.history.reportTimer != txv.history.reportToServerTimeLimit) {
            txv.log("没达到次数限制，不上报服务器:" + txv.history.reportTimer);
            return;
        } else if (flag == -1 || flag == 0) {
            txv.log("不上报开始播放:");
            return;
        }
        txv.history.reportTimer = 0;
        var keyid = txv.history.getStorageKey(txv.history.option.vid, txv.history.option.coverid);
        time = Math.ceil(time);
        total = Math.ceil(total) if (keyid.length < 2 && keyid.indexOf("_") === -1) {
            txv.log("add history error: not enough options!");
            return;
        }
        var retObj = new Live.RetCode(100030);
        $j.ajax({
            url: txv.path.addHistoryRecordCgi,
            dataType: "jsonp",
            data: {
                t: 3,
                time: time,
                keyid: keyid,
                otype: "json"
            },
            CSRF: true,
            beforeSend: function() {
                retObj.begin();
            },
            success: function(json) {
                txv.log("set history record success!");
                txv.dump(json);
                retObj.reprotSuc(json);
            },
            error: function() {
                txv.log("set history record error!");
                retObj.reportErr();
            }
        });
    },
    onRemove: function(key) {
        var $mod = $e("li[key=" + key + "]");
        $mod.remove();
        if ($e("#" + txv.history.mod_id).find("li").size() == 0) {
            txv.history.hisList = null;
            txv.history.showHistory();
        }
    },
    rm: function(key, idx, cb) {
        if (typeof key != "string" || key.length == 0) {
            return;
        }
        if (!txv.login.isLogin()) {
            var $mod = $e("li[key=" + key + "]");
            idx = !isNaN(idx) ? idx: 0;
            $mod.remove();
            txv.history.rmLocal(key, idx);
            return;
        }
        if (typeof(idx) === "function") {
            cb = idx;
        }
        cb = cb || txv.history.onRemove;
        var retObj = new Live.RetCode(100031);
        $j.ajax({
            url: txv.path.queryHistoryRecordCgi,
            dataType: "jsonp",
            data: {
                t: 4,
                keyid: key,
                otype: "json"
            },
            CSRF: true,
            beforeSend: function() {
                retObj.begin();
            },
            success: function(json) {
                if (QZFL.object.getType(json) !== "object") {
                    retObj.reportErr( - 1);
                } else if ( !! json.result && json.result.code == 0) {
                    if (typeof cb == "function") {
                        cb(key);
                    }
                    retObj.reprotSuc();
                } else if ( !! json.result && json.result.code == -11) {
                    retObj.reportErr( - 11);
                    txv.login.openLogin({
                        success: function() {
                            txv.history.rm(key, cb);
                        }
                    });
                } else {
                    retObj.reportErr( - 1);
                }
            },
            error: function() {
                retObj.reportErr( - 1);
                txv.log("set history record error!");
            }
        });
    },
    removeAll: function(cb) {
        txv.history.removeAllLocal();
        txv.common.btnTj("nav.history.del_all");
        if (txv.login.isLogin()) {
            QZFL.Storage.set(txv.history.makeUserStorageKey(), "");
            $j.ajax({
                url: txv.path.queryHistoryRecordCgi,
                dataType: "jsonp",
                data: {
                    t: 5,
                    otype: "json"
                },
                CSRF: true,
                success: function(json) {
                    if (QZFL.object.getType(json) !== "object") {
                        return;
                    }
                    if ( !! json.result && json.result.code == -11) {
                        txv.log("rm all record fail,not login");
                        txv.login.openLogin({
                            success: function() {
                                txv.history.rmAll(cb);
                            }
                        });
                    } else if ( !! json.result && json.result.code == 0) {
                        txv.history.hisList = [];
                        txv.history.showEmpty();
                        if (typeof cb == "function") {
                            cb(json);
                        }
                    } else {
                        txv.log("rm all record fail");
                    }
                },
                error: function() {
                    txv.log("rm all record fail");
                }
            });
        }
        return false;
    },
    showEmpty: function() {
        $e("#" + txv.history.mod_id).html(" 您还没有观看任何视频，暂无记录。");
    },
    toString: function(key, curTime, time, total) {
        if (QZFL.lang.isString(txv.history.option.tit)) {
            txv.history.option.tit = txv.history.option.tit.replace("&#44;", ",");
            return [key, txv.history.option.tit, curTime, time, total].join(',');
        }
        return "";
    },
    removeStorageByKey: function(key) {
        if (typeof(key) !== "string") {
            return;
        }
        QZFL.Storage.set(key, "");
    },
    checkSorageIsExist: (function() {
        var hadChecked = [];
        return function(key) {
            if (typeof(hadChecked[key]) !== "undefined" && hadChecked[key]) {
                return hadChecked[key];
            }
            hadChecked[key] = false;
            var iLen = txv.history.localUserStorgeKeyArr.length;
            for (var idx = 0; idx < iLen; idx++) {
                if (typeof(txv.history.localUserStorgeKeyArr[idx]) === "string" && txv.history.localUserStorgeKeyArr[idx].indexOf(key) === 0) {
                    hadChecked[key] = true;
                    return true;
                }
            }
            return false;
        }
    })(),
    updateStorageArr: function(key, curTime, type) {
        if (arguments.length < 2 || !QZFL.lang.isString(key) || isNaN(curTime)) {
            return;
        }
        for (var idx = 0,
        iLen = txv.history.localUserStorgeKeyArr.length; idx < iLen; idx++) {
            var str = txv.history.localUserStorgeKeyArr[idx];
            if (QZFL.lang.isString(str) && txv.history.localUserStorgeKeyArr[idx].indexOf(key + ",") === 0) {
                var tmp = str.split(",");
                type = type || 1;
                if (type === 1) {
                    tmp[1] = curTime;
                } else {
                    tmp[2] = curTime;
                }
                txv.history.localUserStorgeKeyArr[idx] = tmp.join(",");
                QZFL.Storage.set(txv.history.uinStorageKey, txv.history.localUserStorgeKeyArr.join("|"));
                return;
            }
        }
    },
    addToLocal: function(time, total, flag) {
        var key = txv.history.getStorageKey(txv.history.option.vid, txv.history.option.coverid);
        if (!txv.history.option.tit || !txv.history.option.lnk || key.length < 2 || txv.history.localAddLock || key.indexOf("_") === -1) {
            txv.log("add local history error: option error");
            return false;
        }
        if (!QZFL.lang.isArray(txv.history.localUserStorgeKeyArr)) {
            txv.history.getLocalUserStorgeKeyArr(function() {
                txv.history.addToLocal(time, total, flag);
            });
            return;
        }
        var curTime = txv.history.getCurTimeStmp();
        var storageNumLimit = 5;
        var storagekey = txv.history.makeUserStorageKey();
        if (!txv.history.checkSorageIsExist(storagekey)) {
            txv.history.localUserStorgeKeyArr.push([storagekey, curTime, curTime].join(","));
            QZFL.Storage.set(txv.history.uinStorageKey, txv.history.localUserStorgeKeyArr.join("|"));
        }
        if (txv.history.localUserStorgeKeyArr.length > storageNumLimit + 1) {
            var removeKey, time = curTime,
            removeIdx;
            for (var idx = 0,
            iLen = txv.history.localUserStorgeKeyArr.length; idx < iLen; idx++) {
                if (QZFL.lang.isString(txv.history.localUserStorgeKeyArr[idx])) {
                    var t = txv.history.localUserStorgeKeyArr[idx].split(",");
                    if (t[1] <= time && t[0] !== txv.history.key) {
                        time = t[1];
                        removeKey = t[0];
                        removeIdx = idx;
                    }
                }
            }
            if (!isNaN(removeIdx) && removeIdx < iLen) {
                txv.history.localUserStorgeKeyArr.splice(removeIdx, 1);
                QZFL.Storage.set(txv.history.uinStorageKey, txv.history.localUserStorgeKeyArr.join("|"));
            }
            txv.history.removeStorageByKey(removeKey);
        }
        txv.log(["add local history", time, total].join(','));
        txv.log("storage key:" + storagekey);
        txv.history.getLocalList(storagekey);
        if (!QZFL.lang.isArray(txv.history.localList[storagekey])) {
            txv.history.getLocalList(storagekey,
            function() {
                txv.history.addToLocal(time, total, flag);
            });
            return;
        }
        txv.history.localAddLock = true;
        var his = txv.history.localList[storagekey];
        var len = his.length;
        if (len > storageNumLimit || (len == storageNumLimit && his[0].indexOf(key) !== 0)) {
            his.pop();
        }
        var str = txv.history.toString(key, curTime, time, total);
        if (len == 0) {
            his.unshift(str);
        } else if (his[0].indexOf(key) == 0) {
            his[0] = str;
        } else {
            txv.history.onRemoveLocal(key, storagekey);
            his.unshift(str);
        }
        QZFL.Storage.set(storagekey, his.join('|'));
        txv.history.updateStorageArr(storagekey, curTime, 1);
        txv.history.localAddLock = false;
        if (QZFL.lang.isString(txv.history.timeOrderLocalList[0]) && txv.history.timeOrderLocalList[0].indexOf(key) === -1) {
            if (txv.history.option.coverid.length > 0 && txv.history.timeOrderLocalList[0].indexOf(txv.history.option.coverid) === 0) {
                txv.history.timeOrderLocalList[0] = str;
                txv.history.timeOrderKeyList[0] = storagekey;
            } else {
                txv.history.timeOrderLocalList.unshift(str);
                txv.history.timeOrderKeyList.unshift(storagekey);
            }
            if (!txv.login.isLogin()) {
                txv.history.showLocalHistory(5);
            }
        }
        if (flag == -1 || flag == 0) {
            txv.history.batchReportToServer(5);
        }
    },
    onRemoveLocal: function(key, storagekey) {
        var his = txv.history.localList[storagekey];
        if (typeof(key) != "string" || QZFL.object.getType(his) != "array") {
            return;
        }
        var keyArr = key.split("_");
        for (var i = 0,
        len = his.length; i < len; i++) {
            if (typeof(his[i]) != "string") {
                continue;
            }
            if (his[i].indexOf(key) == 0) {
                his.splice(i, 1);
                break;
            }
            if ( !! keyArr[0] && his[i].indexOf(keyArr[0]) == 0) {
                his.splice(i, 1);
                break;
            }
            if ( !! keyArr[1] && his[i].indexOf(keyArr[1]) == 0) {
                his.splice(i, 1);
                break;
            }
        }
        txv.history.localList[storagekey] = his;
        QZFL.Storage.set(storagekey, his.join('|'));
    },
    rmLocal: function(key, idx) {
        if (typeof key != "string" || key.length == 0) {
            return;
        }
        idx = !isNaN(idx) ? idx: 0;
        if (txv.login.isLogin()) {
            var storagekey = txv.history.makeUserStorageKey();
        } else {
            if (QZFL.lang.isArray(txv.history.timeOrderKeyList) && QZFL.lang.isArray(txv.history.timeOrderLocalList)) {
                var storagekey = txv.history.timeOrderKeyList[idx];
                txv.history.timeOrderKeyList.splice(idx, 1);
                txv.history.timeOrderLocalList.splice(idx, 1);
            } else {
                return;
            }
        }
        if (!QZFL.lang.isArray(txv.history.localList[storagekey])) {
            txv.history.getLocalList(storagekey,
            function() {
                txv.history.rmLocal(key);
            });
            return;
        }
        txv.history.onRemoveLocal(key, storagekey);
        if (storagekey !== txv.history.key) {
            txv.history.onRemoveLocal(key, txv.history.key);
        }
        if (!txv.login.isLogin()) {
            txv.history.showLocalHistory(5);
        }
    },
    getCurTimeStmp: function() {
        return Math.ceil(( + new Date()) / 1000);
    },
    removeAllLocal: function() {
        var localKey = txv.history.key;
        var userKey = txv.history.makeUserStorageKey();
        txv.history.localList[localKey] = [];
        txv.history.localList[userKey] = [];
        txv.history.localList = [];
        QZFL.Storage.set(localKey, "");
        QZFL.Storage.set(userKey, "");
        if (!txv.login.isLogin()) {
            if (!QZFL.lang.isArray(txv.history.localUserStorgeKeyArr)) {
                txv.history.getLocalUserStorgeKeyArr(function() {
                    txv.history.removeAllLocal();
                }) return;
            }
            QZFL.object.each(txv.history.localUserStorgeKeyArr,
            function(val) {
                if (QZFL.lang.isString(val)) {
                    var arr = val.split(",");
                    QZFL.Storage.set(arr[0], "");
                }
            });
            txv.history.localUserStorgeKeyArr = [];
            QZFL.Storage.set(txv.history.uinStorageKey, "");
            txv.history.showEmpty();
        }
        return false;
    },
    getHistoryTimeByKey: function(vid, coverid, cb) {
        vid = vid || txv.history.option.vid;
        coverid = coverid || txv.history.option.coverid;
        cb = typeof(cb) !== "function" ? Live.emptyFn: cb;
        var key = txv.history.getStorageKey(vid, coverid);
        var hls = [];
        var recordArr = [];
        var storagekey = txv.history.makeUserStorageKey();
        var time = 0;
        if (QZFL.lang.isArray(txv.history.localList[storagekey])) {
            hls = txv.history.localList[storagekey];
        } else {
            txv.history.getLocalList(storagekey,
            function() {
                txv.history.getHistoryTimeByKey(vid, coverid, cb);
            });
            return;
        }
        if (hls.length == 0) {
            time = 0;
        } else {
            for (var idx = 0,
            len = hls.length; idx < len; idx++) {
                recordArr = hls[idx].split(",");
                if (recordArr.length < 4) {
                    continue;
                }
                if (QZFL.inArray(recordArr[0], [key, vid, coverid]) != -1) {
                    recordArr[3] = parseInt(recordArr[3]);
                    if (isNaN(recordArr[3]) || QZFL.inArray(recordArr[3], [ - 2, -1]) != -1) {
                        time = 0;
                    } else if (recordArr[3] < 0) {
                        time = recordArr[3] * -1;
                    }
                    time = recordArr[3];
                    break;
                }
            }
        }
        cb(time);
    },
    parseLocalRecord: function(val) {
        var retArr = [];
        if (QZFL.object.getType(val) == "object" && typeof(val.value) == "string") {
            val = val.value;
        }
        if ("string" == typeof(val) && val.length > 0) {
            retArr = val.split("|");
        }
        return retArr;
    },
    makeUserStorageKey: function() {
        return txv.login.isLogin() ? (txv.history.key + txv.login.getUin()) : txv.history.key;
    },
    filterSameRecord: function(arr) {
        var retArr = [],
        map = {},
        idxMap = {},
        tmpArr = [];
        if (QZFL.lang.isArray(arr)) {
            QZFL.object.each(arr,
            function(val) {
                if (QZFL.lang.isString(val)) {
                    tmpArr = val.split("+");
                    val = encodeURI(val);
                    if (QZFL.lang.isString(tmpArr[0])) {
                        var idx = tmpArr[0].indexOf("_");
                        if (idx > 0) {
                            tmpArr[0] = tmpArr[0].substr(idx);
                        }
                        if (typeof(map[tmpArr[0]]) === "undefined") {
                            map[tmpArr[0]] = tmpArr[2];
                            retArr.push(val);
                            idxMap[tmpArr[0]] = retArr.length - 1;
                        } else if (map[tmpArr[0]] < tmpArr[2]) {
                            map[tmpArr[0]] = tmpArr[2];
                            retArr[idxMap[tmpArr[0]]] = val;
                        }
                    }
                }
            });
        }
        return retArr;
    },
    batchReportToServer: function(count, cb) {
        count = count || 5;
        cb = typeof(cb) === "function" ? cb: QZFL.emptyFn;
        if (!txv.login.isLogin() || txv.history.hadbatchReport) {
            cb();
            return;
        }
        var hls = [];
        var reportCount = count;
        var isChanged = false;
        if (!QZFL.lang.isArray(txv.history.localList[txv.history.key])) {
            txv.history.getLocalList(txv.history.key,
            function() {
                txv.history.batchReportToServer(count);
            });
            return;
        }
        var userStorageKey = txv.history.makeUserStorageKey();
        if (!QZFL.lang.isArray(txv.history.localList[userStorageKey])) {
            txv.history.getLocalList(userStorageKey,
            function() {
                txv.history.batchReportToServer(count);
            });
            return;
        }
        if (!QZFL.lang.isArray(txv.history.localUserStorgeKeyArr)) {
            txv.history.getLocalUserStorgeKeyArr(function() {
                txv.history.batchReportToServer(count);
            });
            return;
        }
        var c = {
            localList: false,
            userList: false
        };
        var lastReportTime = {
            localList: 0,
            userList: 0
        }
        QZFL.object.each(txv.history.localUserStorgeKeyArr,
        function(val, idx) {
            if (QZFL.lang.isString(val)) {
                if (val.indexOf(txv.history.key + ",") === 0) {
                    var arr = val.split(",");
                    if (arr[1] >= arr[2]) {
                        c.localList = true;
                        lastReportTime.localList = arr[2];
                    }
                } else if (val.indexOf(userStorageKey + ",") === 0) {
                    var arr = val.split(",");
                    if (arr[1] >= arr[2]) {
                        c.userList = true;
                        lastReportTime.userList = arr[2];
                    }
                }
            }
        });
        var curTime = txv.history.getCurTimeStmp();
        var reportArr = [];
        var opt = [];
        var tmpStr = "";
        var localList = txv.history.localList[txv.history.key];
        var userList = txv.history.localList[userStorageKey];
        var iLen = Math.max(localList.length, userList.length);
        var isChanged = false;
        for (var idx = 0; idx < iLen; idx++) {
            if (typeof(localList[idx]) === "string" && c.localList) {
                opt = localList[idx].split(",");
                if (opt.length >= 4 && QZFL.lang.isString(opt[0]) && opt[0].indexOf("_") !== -1) {
                    if (isNaN(opt[2])) {
                        isChanged = true;
                        opt[2] = curTime;
                        tmpStr = [opt[0], opt[3], opt[2]].join("+");
                        localList[idx] = opt.join(",");
                        reportArr.push(tmpStr);
                    } else if (opt[2] >= lastReportTime.localList) {
                        tmpStr = [opt[0], opt[3], opt[2]].join("+");
                        reportArr.push(tmpStr);
                    } else {
                        c.localList = false;
                        if (c.userList == false) {
                            break;
                        }
                    }
                }
            }
            if (typeof(userList[idx]) === "string" && c.userList) {
                opt = userList[idx].split(",");
                if (opt.length >= 4 && QZFL.lang.isString(opt[0]) && opt[0].indexOf("_") !== -1) {
                    if (isNaN(opt[2])) {
                        isChanged = true;
                        opt[2] = curTime;
                        tmpStr = [opt[0], opt[3], opt[2]].join("+");
                        userList[idx] = opt.join(",");
                        reportArr.push(tmpStr);
                    } else if (opt[2] >= lastReportTime.userList) {
                        tmpStr = [opt[0], opt[3], opt[2]].join("+");
                        reportArr.push(tmpStr);
                    } else {
                        c.userList = false;
                        if (c.localList == false) {
                            break;
                        }
                    }
                }
            }
        }
        if (isChanged) {
            QZFL.Storage.set(txv.history.key, localList.join("|"));
            QZFL.Storage.set(userStorageKey, userList.join("|"));
            txv.history.localList[txv.history.key] = localList;
            txv.history.localList[userStorageKey] = userList;
        }
        reportArr = txv.history.filterSameRecord(reportArr);
        if (reportArr.length > 0) {
            txv.log("list:" + reportArr.join("|"));
            var retObj = new Live.RetCode(100031);
            txv.history.hadbatchReport = true;
            $j.ajax({
                url: txv.path.addHistoryRecordCgi,
                dataType: "jsonp",
                data: {
                    t: 4,
                    cur: 1,
                    simp: 1,
                    pn: count,
                    list: reportArr.join("|"),
                    otype: "json"
                },
                CSRF: true,
                beforeSend: function() {
                    retObj.begin();
                },
                success: function(json) {
                    txv.log("batchReportToServer success!");
                    txv.dump(json);
                    retObj.reprotSuc(json);
                    if (QZFL.object.getType(json) === "object" && QZFL.object.getType(json.result) === "object" && json.result.code === 0) {
                        txv.history.updateStorageArr(txv.history.key, curTime, 2);
                        txv.history.updateStorageArr(userStorageKey, curTime, 2);
                        txv.history.hisList = json;
                        txv.history.renderContent(json);
                    }
                    cb();
                },
                error: function() {
                    txv.log("batchReportToServer error!");
                    retObj.reportErr();
                    cb();
                }
            });
        } else {
            cb();
        }
    }
};
function _flash_view_history(flag, time, total) {
    if (arguments.length != 3) {
        return;
    }
    txv.log("_flash_view_history:" + flag + "," + time + "," + total);
    if ( - 1 != flag && total < txv.history.timeLongLimit) {
        txv.log("小于一定时长的视频只记录开始播放点,当前限制为:" + txv.history.timeLongLimit);
        return;
    }
    if ( - 2 == flag) {
        txv.log("播放结束了");
        time = -2;
    }
    if (total - time < 60) {
        txv.log("剩下不足1分钟");
        time *= -1;
    }
    txv.history.add(flag, time, total);
}
Live.txv.template = {
    _isLoadingJS: false,
    timer: {
        waitJS: 0
    },
    FILL_TYPE: {
        TPL_ID: 1,
        TPL_STR: 2
    },
    convertTime: function(d) {
        var month = d.getMonth() + 1;
        var day = d.getDate();
        var hour = d.getHours();
        var min = d.getMinutes();
        var sec = d.getSeconds();
        function fillZero(str) {
            return str < 10 ? "0" + str: str;
        }
        return {
            "year": d.getFullYear(),
            "month": month,
            "day": day,
            "hour": fillZero(hour),
            "min": fillZero(min),
            "sec": fillZero(sec)
        }
    },
    MODIFIERS: {
        formatTime: function(str) {
            if (!/\d+/.test(str)) return str;
            var v = parseInt(str) * 1000;
            var d = new Date(v);
            var dd = Live.txv.template.convertTime(d);
            return [[dd.year, dd.month, dd.day].join("-"), [dd.hour, dd.min, dd.sec].join(":")].join(" ");
        },
        getTimeLong: function(time) {
            var m = parseInt(time / 60);
            var s = time % 60;
            return "" + m + "分钟" + s + "秒";
        },
        getAvatar: function(uin, size) {
            size = size || 50;
            return ["http://qlogo", uin % 4 + 1, ".store.qq.com/qzone/", uin, "/", uin, "/", size].join("")
        },
        getTimeLong2: function(time) {
            var m = parseInt(time / 60);
            var s = time % 60;
            return "" + m + "&#039;" + s + "&#034;";
        },
        getTimeLong3: function(time) {
            var m = parseInt(time / 60);
            var s = time % 60;
            if (s < 10) s = "0" + s;
            return "" + m + ":" + s;
        },
        getFormatNum: function(num) {
            if (!num || typeof(num) != "number") return 0;
            var na = ("" + num).split("").reverse();
            var re = [];
            for (var i = 0,
            len = na.length; i < len; i++) {
                if (i > 0 && i % 3 == 0) {
                    re.push(',');
                }
                re.push(na[i]);
            }
            return re.reverse().join("");
        },
        encode2: function(str) {
            return encodeURIComponent(str.replace(/<em[^>]+>/g, "").replace(/<\/em>/g, ""));
        },
        getZY_TV_URL: function(tvid) {
            if (!tvid || tvid == "") tvid = -1;
            return ["http://v.qq.com/variety/type/list_", tvid, "_0_0.html"].join("");
        },
        getZY_TP_URL: function(lxid) {
            if (!lxid || lxid == "") lxid = -1;
            return ["http://v.qq.com/variety/type/list_", lxid, "_0_0.html"].join("");
        },
        filterComment: function(str) {
            return str.replace(/\\r\\n/ig, "<br/>");
        },
        getPlayUrl: function(cid) {
            return txv.common.getPlayUrl(cid);
        },
        getDetailUrl: function(cid, typeid) {
            return txv.common.getDetailUrl(cid, typeid || 0);
        },
        getVideoPlayUrl: function(vid) {
            return txv.common.getVideoPlayUrl(vid);
        },
        getBokePlayUrl: function(vid) {
            return txv.common.getBokePlayUrl(vid);
        },
        encode: function(str) {
            return encodeURIComponent(str);
        },
        searchurl: function(tag) {
            return txv.path.search_cgi + "&ms_key=" + encodeURIComponent(tag);
        },
        getVideoSnap: function(vid) {
            return txv.common.getVideoSnap(vid, 0);
        },
        getKuainvPlayUrl: function(cid) {
            if (!cid) return "";
            if (cid.length == 15) {
                var str = [txv.common.rootPath, "/kuainv/cover/", cid.charAt(0), "/", cid, ".html"].join("");
                return str;
            }
            return "";
        },
        filterStr: function(str) {
            return QZFL.string.filterAngAndQt(str);
        },
        getTimeDiff: function(time) {
            if (isNaN(time)) {
                return time;
            }
            if (/^\d{10}$/.test(time)) {
                time = time * 1000;
            }
            var dd = new Date(time);
            var now = new Date();
            var todaySec = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds();
            var t0 = new Date().valueOf();
            var sec = parseInt((t0 - time) / 1000);
            var strtm = "";
            if (sec < 60) {
                strtm = "刚刚";
            } else if (sec > 60 && sec < 3600) {
                strtm = Math.ceil(sec / 60) + "分钟前";
            } else {
                var dataObj = Live.txv.template.convertTime(dd);
                if (sec >= 3600 && sec < todaySec) {
                    strtm = "今天 " + dataObj.hour + ":" + dataObj.min;
                } else if (sec > todaySec && sec < todaySec + 86400) {
                    strtm = "昨天 " + dataObj.hour + ":" + dataObj.min;
                } else {
                    strtm = dataObj.month + "月" + dataObj.day + "日" + " " + dataObj.hour + ":" + dataObj.min;
                }
            }
            return strtm;
        }
    },
    fillHtml: function(json, tplid, containerid, isClear, modifiers, filltype, callback, isResetLink) {
        function fill(_json, _tplid, _containerid, _isClear, _modifiers, _filltype, _callback, _isResetLink) {
            txv.template._isLoadingJS = false;
            var container = $(_containerid);
            if (!container) return;
            if (typeof filltype == "undefined") {
                filltype = Live.txv.template.FILL_TYPE.TPL_ID;
            }
            if ((filltype == Live.txv.template.FILL_TYPE.TPL_ID && !$(_tplid)) || (filltype == Live.txv.template.FILL_TYPE.TPL_STR && !_tplid)) return;
            if (typeof _isClear == "undefined") {
                _isClear = true;
            }
            if (typeof filltype == "undefined") {
                filltype = Live.txv.template.FILL_TYPE.TPL_ID;
            }
            _json._MODIFIERS = _modifiers || Live.txv.template.MODIFIERS;
            var myTemplateObj = filltype == Live.txv.template.FILL_TYPE.TPL_ID ? TrimPath.parseDOMTemplate(_tplid) : TrimPath.parseTemplate(_tplid);
            var result = myTemplateObj.process(_json);
            if ( !! _isClear) {
                container.innerHTML = result;
            } else {
                container.innerHTML += result;
            }
            if (typeof _isResetLink == "undefined") {
                _isResetLink = true;
            }
            if ( !! _isResetLink && txv.common.isWebqq()) {
                $e("#" + _containerid + " a").attr("target", "_self");
            }
            if (typeof _callback == "function") {
                _callback();
            }
        }
        if (typeof TrimPath == "undefined") {
            if (txv.template._isLoadingJS == false) {
                txv.log("template is not load js");
                txv.template._isLoadingJS = true;
                $j.getScript(Live.txv.path.trimpath,
                function() {
                    fill(json, tplid, containerid, isClear, modifiers, filltype, callback, isResetLink);
                });
            } else {
                txv.log("template is loading js,wait...");
                setTimeout(function() {
                    txv.template.fillHtml(json, tplid, containerid, isClear, modifiers, filltype, callback, isResetLink);
                },
                100);
            }
        } else {
            fill(json, tplid, containerid, isClear, modifiers, filltype, callback, isResetLink);
        }
    }
}
/*  |xGv00|101da6b4c0385526a6ef8ccd003bbde3 */
